Conditional Formula - How do I prevent a return of "0"

  • Thread starter Thread starter EU
  • Start date Start date
E

EU

If cells A2 and/or B2 are blank, what do I have to include
in =SUM(A2+B2) to keep it from returning "0".

Thanks,

EU
 
=IF(OR(A2="",B2=""),"",A2+B2)

You don't need the SUM bit in your original formula. =A2+B2 works just fine.
 
For a 0 answer
=IF(SUM(A2,B2)=0,"",SUM(A2,B2))
"" returns nothing

To return nothing if either A2 or B2 are blank
=IF(OR(A2="",B2=""),"",SUM(A2,B2)))

Note: Using the Sum formula with the + formula is
repetative (you don't need both)
SUM(A2,B2) is the same as A2+B2 is the same as
SUM(A2+B2)

Dan E
 
Thanks, Ken. It works perfectly.
EU
-----Original Message-----
=IF(OR(A2="",B2=""),"",A2+B2)

You don't need the SUM bit in your original formula. =A2+B2 works just fine.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP

---------------------------------------------------------- ------------------
Attitude - A little thing that makes a BIG difference
---------------------------------------------------------- ------------------






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 29/09/2003


.
 
Thanks, Dan. I appreciate your valuable help!
EU
-----Original Message-----
For a 0 answer
=IF(SUM(A2,B2)=0,"",SUM(A2,B2))
"" returns nothing

To return nothing if either A2 or B2 are blank
=IF(OR(A2="",B2=""),"",SUM(A2,B2)))

Note: Using the Sum formula with the + formula is
repetative (you don't need both)
SUM(A2,B2) is the same as A2+B2 is the same as
SUM(A2+B2)

Dan E




.
 
=IF(AND(A2="",B2=""),"",A2+B2)

Translation:

If (A2 = "") AND (B2 = ""), return ""
Else return A2+B2

--Dan
 
Back
Top