开发者

Range Limiting the result of a formula

How do I Make a range of Cells to Zero If a calculation gi开发者_Go百科ves A Negative Number?

Example: =D12-D19

Answer: -1

I would like to replace the negative to zero.


More efficiently, you could use:

=MAX(0, SUM(A1:A5))


Try this:

=IF(SUM(A1:A5) < 0, 0, SUM(A1:A5))

or depending on your locale:

=IF(SUM(A1:A5) < 0; 0; SUM(A1:A5))

which means:

IF the sum of the cells A1 + A2 + A3 + A4 + A5 is less than 0
  make it 0
ELSE
  make it the sum of the cells A1 + A2 + A3 + A4 + A5
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜