Reputation: 4305
I am a novice in Excel. I want to have a formula for the following condition (shown in line 20 in the image):
AF is the sum of the columns in red (D, H and L) only if the associated column on their right (E, I and M) contains the letter 'X'. In the image below the sum is 700 because only I and M contains X. If E would contains 'X' the sum would it be 1050.
Upvotes: 2
Views: 1565
Reputation: 8415
If you would consider using 1 instead of X, then it becomes much simpler :
=D20*E20+H20*I20+L20*M20
So, E20 is 0 then I20 is 1 and M20 is 1.
Edit based on Richard's excellent suggestion which means you keep the X's as original:
=D20*ISTEXT(E20)+H20*ISTEXT(I20)+L20*ISTEXT(M20)
WARNING, this will assume ANY text X, Z, G, will be true so will get counted...
Upvotes: 1
Reputation: 152
=SUM(IF(E20="x",D20,0),IF(I20="x",H20,0),IF(M20="x",L20,0))
Copy this code to cell AF20, then extend it.
Upvotes: 1