View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David McRitchie
 
Posts: n/a
Default IF function for blank cell

If the question was correct then that should be an AND
and you might have to use SUM if either A1 or B1 is empty

=IF(AND(a1="",B1=""),"",SUM(A1:B1))

sometimes people put a space into a cell or a null string simiar to what is
being entered into Cell C1 with ="", so you might have to consider
=IF(AND(TRIM(A1)="",TRIM(B1)=""),"",SUM(A1:B1))

if the cell is actual empty, tests true for =ISBLANK(A1), then would work for A1+B1
but a cell with a null string would fail with a #VALUE! error..
SUM will ignore text constants.

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Chip Pearson" wrote in message ...
Try

=IF(OR(A1="",B1=""),"",A1+B1)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"bayanbaru" wrote in
message
...
My formula is C1=SUM(A1: B1). I want to use IF function. If A1
and B1 is
blank C1 should be blank. Right now it show C1=0