=IF(AND(AI8="-",AJ8="-"),AH8,IF(AND(AI8="-",AJ8>0),AH8+AJ8,IF(AND(AI8>0,AJ8>0),AH8+AI8+AJ8,AH8+AI8)))

First of all, cell AH8 is always >0 and my problem is I am trying to determine the formula if:

- cell AI8 ="-" and AJ8 ="-" then the cell I am trying to input formula equals AH8

- cell AJ8 = "-" and AI8 >0 then it equals AH8+AI8

- cell AI8 = "-" and AJ8>0 then it's AH8+AJ8

- cell AI8 and AJ8>0 then it's AH8+AI8+AJ8.

I am not sure where's the mistake of my formula. Please help!

Your problem is that AJ8>0 will evaluate as TRUE, if the cell contains a Dash,

so when you try to add AH8+AI8+AJ8 you get a value errorTry this:

=IF(AND(AI8="-",AJ8="-"),AH8,IF(AND(AI8="-",AJ8>0),SUM(AH8,AJ8),IF(AND(AI8>0,AJ8>0),SUM(AH8,AI8,AJ8),SUM(AH8,AI8))))

MIKE

Ask Your Question

Weekly Poll