logical expression help please

K

KRK

Hello,

What does the logical expression (A1<A2<A3<A4) return ?

How is the expression evaluated ?

I've tried various numbers in A1....A4, but cannot seem to make sense of
what the expression is doing ?


Thanks

KK
 
K

KRK

KRK said:
Hello,

What does the logical expression (A1<A2<A3<A4) return ?

How is the expression evaluated ?

I've tried various numbers in A1....A4, but cannot seem to make sense of
what the expression is doing ?


Thanks

KK


For example, the expression (1<2<3) evaluates to FALSE (though it would
appear to be true, and (1>2>3) evaluates to TRUE, though it would seem to be
false.

K
 
G

Gary''s Student

You may be slightly backwards:
1<2<3
since clearly 2 is greater than 3 this is the same as:
1<1
which is false.

Since 1 cannot be less than either 0 or 1, this type of statement is ALWAYS
false.
 
S

Shane Devenshire

Hi,

Here is what is going on:

Suppose =1<2<3 is your formula

Excel starts on the left and evaluates 1<2 which is TRUE, next it evalueates
TRUE<3 and returns FALSE. It never evaluates 2<3 in this example.
 
J

joeu2004

What does the logical expression  (A1<A2<A3<A4) return ?
[....]
For example, the expression (1<2<3) evaluates to FALSE
(though it would appear to be true, and (1>2>3) evaluates
to TRUE, though it would seem to be false.

I suspect the logical expression you want is:

AND(A1<A2,A2<A3,A3<A4)

Alternatively:

(A1<A2)*(A2<A3)*(A3<A4)
 
K

KRK

Shane,

OK thanks but...In that case why does 1>2>3 return TRUE ?.

1>2 is FALSE,

giving FALSE>3

= TRUE ?????

why is FALSE>3 True ?

Sorry I must be daft I don't understand. What are the 'number values' of
TRUE and FALSE ??

K
 
K

KRK

Hi, Thanks, yes I agree, that is where I started.

But I was surprised to find that the boolean (a1<a2<a3<a4) actually gives an
answer (rather than causing an error) and if I could understand how it
worked it might be a more elegant way of doing the job.

KK

What does the logical expression (A1<A2<A3<A4) return ?
[....]
For example, the expression (1<2<3) evaluates to FALSE
(though it would appear to be true, and (1>2>3) evaluates
to TRUE, though it would seem to be false.

I suspect the logical expression you want is:

AND(A1<A2,A2<A3,A3<A4)

Alternatively:

(A1<A2)*(A2<A3)*(A3<A4)
 
J

joeu2004

why does 1>2>3 return TRUE ?.
1>2 is FALSE, giving FALSE>3
= TRUE ?????
why is FALSE>3 True ?

Sorry I must be daft I don't understand. What are the
'number values' of TRUE and FALSE ??

If we convert the logic values TRUE and FALSE to numeric values (e.g.
--(A1>A2)), we get 1 and 0 respectively.

But apparently, the reverse is not true. Try computing =(A1=FALSE)
and =(A1=TRUE), where A1 is any numeric or text value. The result is
always FALSE. And only TRUE>FALSE, FALSE<TRUE, TRUE=TRUE and
FALSE=FALSE are TRUE.

Apparently, we can only meaningfully compare logic values with other
logic values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

help with dates please 4
Excel =SUM(A1=A1+B1) 0
Access Query problem 1
Sum number range ignoring numbers formatted as text 0
Formula needed please... 4
Nested IF statements 1
Help Creating Excel Formula 4
Creating a list of cell values 3

Top