Janine
Janine

Reputation: 3

multiple if/and statement returning #value! error

I need help with a statement that is returning #value!

I need to my statement to work out if both K4 and I4 are blank then it will return the value in H4. However if only K4 is blank then I want it to show the value of I4 minus H4.

This is what I have but it isn't working.

=IF(AND(K4="",I4=""),H4),IF(K4="",I4-H4)

Upvotes: 0

Views: 462

Answers (2)

Nitesh Halai
Nitesh Halai

Reputation: 927

You have not nested your formulas properly. Also for the second condition, it is better to use "<>" (not equal to) to test whether I4 is not blank.

=IF(AND(K4="",I4=""),H4,IF(I4<>"",I4-H4,IF(K4<>"",K4-H4,"")))

Upvotes: 0

Arulkumar
Arulkumar

Reputation: 13237

Can you try the following formula:

=IF(AND(K4 = "", I4 = ""), H4, IF(K4 = "", I4-H4, ""))

Also please check on how to use the nested IF function

Upvotes: 1

Related Questions