View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default sumif returns blank if all cells blank

Alternatives:
1) USE simple =SUM(range) but give the cell a custom format that does not
display zero, such as #;-#;;

2)=IF(COUNT(B2:F2),SUM(B2:F2),"")
If any cell is non-blank then COUNT is a number greater than 0 which Excel
treats as TRUE and computes the sum, else it displays a blank

I do hope you plan to put the formula somewhere other than E2. Since B2:F2
includes E2, you will get a circular reference error with the formula in E2!
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Heliocracy" wrote in message
...
Hi all, I have rows in which columns b-f may be blank or have numerical
values in them, and in column e of the same row I need to be able to sum
these numbers if there are any, but remain blank if ALL of columns b-f are
blank. The problem I'm having with:

{=IF(ISBLANK(B2:F2),"",SUM(B2:F2))} in cell e2

is that it returns "" if ANY of the cells in b2:f2 are blank. In other
words, I need a formula in e2 that sums b2:f2 if any of those cells are
not
blank, but returns blank if all cells in b2:f2 are blank. If all cells in
b2:f2 contain zeroes, then e2 should contain a zero, but if all cells in
b2:f2 are blank, e2 should be blank.

Thanks in advance for your help.