ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   sum numbers only when a named cell is not zero (https://www.excelbanter.com/excel-discussion-misc-queries/42632-sum-numbers-only-when-named-cell-not-zero.html)

Cheryl McHarg

sum numbers only when a named cell is not zero
 
In my spreadsheet, I need cell L10 to sum cells ( M10-P10) if P10 does not
equal zero. P10 is a formula=+n10+O10.

Bryan Hessey


Cheryl,

try

=if($P$10<0,sum(M10:P10),"")

or

=if($P$10<0,sum(M10:P10),0)

to reflect a zero.


Cheryl McHarg Wrote:
In my spreadsheet, I need cell L10 to sum cells ( M10-P10) if P10 does
not
equal zero. P10 is a formula=+n10+O10.



--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile: http://www.excelforum.com/member.php...o&userid=21059
View this thread: http://www.excelforum.com/showthread...hreadid=399694


JE McGimpsey

One way:

=IF(P10<0,SUM(M10:P10),"")

Given P10's formula, it could also be

=IF(P10<0, 2*P10+M10,"")

or, if you want to return 0 instead of a null string:

=(P10<0)*(2*P10+M10)


Note that the first "+" in your formula is superfluous.

In article ,
"Cheryl McHarg" <Cheryl wrote:

In my spreadsheet, I need cell L10 to sum cells ( M10-P10) if P10 does not
equal zero. P10 is a formula=+n10+O10.



All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com