Solved Returning an empty cell if both cells I'm adding are empty

December 30, 2012 at 11:48:18
Specs: Windows 7
I would like to write an IF statement in cell A3 that says, IF cells A1 and A2 are both empty (i.e. neither of them has a numbers in it), then leave cell A3 blank, but if either A1 or A2 (or both) has a number in it, then sum those two cells in A3. To take it one step further, I'd like to wrap it in an IF(ISERROR) function. Any help would be much appreciated.

See More: Returning an empty cell if both cells Im adding are empty

Report •


#1
December 30, 2012 at 12:00:23
✔ Best Answer
=IF(AND(A1="",A2=""),"",SUM(A1,A2))

You say you want to wrap it in an ISERROR function but you don't say what you want returned if an error exists.

It would also help if we knew what error you are expecting and/or checking for.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
December 31, 2012 at 08:25:00
Thanks DerbyDad - I appreciate it. I'm not anticipating any particular errors, just being conservative. I would like the ISERROR function to return a hyphen if there is an error.

Report •

#3
December 31, 2012 at 09:33:06
I guess this would work...

=IF(ISERROR(SUM(A1,A2)),"-",IF(AND(A1="",A2=""),"",SUM(A1,A2)))

BTW...why did you mark the thread solved if you were still looking for more assitance?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions

#4
December 31, 2012 at 10:04:28
The IF(AND...) part was the more important component for me and the likelihood of errors calculating what I'm calculating is low. Thanks for your help with this.

Report •


Ask Question