Anish
Anish

Reputation: 758

Excel: IF AND statement not working both ways

I'm using a IF AND statement to check a simple statement, for example A>B&BB, I get FALSE. How is that even possible?

My data sample:

enter image description here

It works both ways if I use AND(), but I prefer to use &.

Upvotes: 2

Views: 849

Answers (2)

zipa
zipa

Reputation: 27869

Use AND():

IF(AND(A2>C2,C2<B2),TRUE,FALSE)

Or as was written in comments you can use multiplication:

IF((A2>C2)*(C2<B2),TRUE,FALSE)

FYI - you don't need IF().

If you use AND(A2>C2,C2<B2) the result will be Boolean (TRUE/FALSE).

Upvotes: 3

A.S.H
A.S.H

Reputation: 29332

You may "prefer to use &" but unfortunately this operator in Excel has a different meaning: string concatenation. If you dont want to use AND, you can use * instead; but you will need to parenthesize the terms.

 =IF((A2>C2)*(C2<B2), TRUE, FALSE)

Upvotes: 3

Related Questions