Dr3am3rz
Dr3am3rz

Reputation: 563

Excel sum using cell value if another cell is blank

Col A Col B Col C Col D Col E
5000 1000 100
5000 1000 100 150

Currently my formula for Col E is

=SUM(Col B * 12 - Col C / Col A)

How do I change my formula so that if Col D have value, it will take Col D value else, it will take Col C value?

Can someone out there please help me out with this? Thanks!

Upvotes: 0

Views: 1553

Answers (1)

Fernando Barbosa
Fernando Barbosa

Reputation: 1134

The formula on the comments works. However, I think it is clearer for beginners to put the IF outside and the full formulas inside. I mean:

=IF(D2="", (B2*12-C2)/A2, (B2*12-D2)/A2)

In words, if D2 is empty use the 1st formula. Else, use the 2nd formula.



I would use the function ISBLANK to get when column D is empty. In that case:

=IF(ISBLANK(D2), (B2*12-C2)/A2, (B2*12-D2)/A2)

If that is true that D2 is blank, use the 1st formula. Else, use the 2nd one.

Upvotes: 1

Related Questions