Cornelis
Cornelis

Reputation: 435

Apply formula on condition

I'd like to add a condition to one of my Excel formulas. In Cell C1 I have a formula like this : = A1 +B1 but if cell A1 is empty but cell B1 does contain a value (or vice versa) I'd like cell C1 to stay empty.

Condition : Only apply formula if both cells contain any value.

(The formula I'm using in cell C1 calculates the difference between dates, and does this for a list of values, so it is applied on the whole range "C:C".)

Upvotes: 0

Views: 109

Answers (2)

helena4
helena4

Reputation: 282

=IF(SUM(IF(A1="",0,1),IF(B1="",0,1))<2,"",A1+B1)

Upvotes: 1

Poof
Poof

Reputation: 169

Here you go

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

Upvotes: 3

Related Questions