SOLVED

# IF function

Hi,

I´m trying to write a simple formula along the lines of: IF((1<2<3), "ok", "x")

Why does excel return x and how do I rewrite it, so the excel returns ok?

Thanks

4 Replies
best response confirmed by Hans Vogelaar (MVP)
Solution

# Re: IF function

=IF(AND(1<A1,A1<3), "ok", "x")

Does this return the intended result? Basically you have to reference the cell that you want to evaluate.

# Re: IF function

Thank you! This works perfectly
(I didn´t realise, that AND is necessary in this case)

# Re: IF function

FYI, just so you understand, when you write 1<2<3 excel will interpret that as a single equation piece by piece and after the 'first step' will have either TRUE<3 which results in FALSE. That said if you try 3>2>1 then you have TRUE>1 and the result is TRUE. Basically excel considers T/F values > any numeric value. For example, 3<2>99999999 results in TRUE because 3<2 is FALSE and FALSE>9999999 evaluates to TRUE.
I'm a strong believer that it is very important to understand HOW your tool works.