Reputation: 129
I found that excel has an if feature that is
= IF(booleanExpression, trueValue, falseValue)
I am trying to use it but i think there is something wrong with my boolean statement.
I have:
=IF ( ( ((.8*P20)>(1.35*H20)) AND ( (.8*P20)<(2*H20))), (.8*P20), (1.35*H20))
I'm assuming my problem is with the AND part. Is there a way i can check two conditions here?
Upvotes: 1
Views: 41
Reputation: 96753
The syntax of the AND is different:
=IF(AND(statement1, statement2), v_if_true, v_if_false)
VBA uses AND differently:
If statement1 AND statement2 Then
Upvotes: 2
Reputation: 16423
Just use AND
to equate multiple values:
=IF(AND(0.8 * P20 > 1.35 * H20, 0.8 * P20 < 2 * H20), 0.8 * P20, 1.35 * H20)
Btw your use of brackets was a bit excessive so I've removed them here.
See this Microsoft article for more information on AND
: https://support.office.com/en-my/article/AND-function-5f19b2e8-e1df-4408-897a-ce285a19e9d9
Upvotes: 1