Forum Discussion
Writing an ELIF statement with multiple ANDs
- Apr 17, 2024
Did you check suggested formula if it works for you?
In Excel you can't use in formula "15>A3>=10", that could be
AND(A3>=10, A3<15)
or in another notation
(A3>=10)*(A3<15)
SergeiBaklan thanks for the reply. I am trying to evaluate cell a3 and cell b2. The range that I want to see in a3 is a value between 10 and 15 inclusively and a value in cell b2 between 15 and 35 inclusively. If both of those conditions are met then write "true" if not then write "false". That is why I have those conditions formatted the way that I do,
i.e. condition 1 ---> 15>A3>=10 (15 is greater than cell A3 and cell A3 is greater than or equal to 10)
condition 2 ---> 15<=B2<=35 (15 is less than or equal to cell B2 and cell B2 is less than or equal to 35)
- SergeiBaklanApr 17, 2024MVP
Did you check suggested formula if it works for you?
In Excel you can't use in formula "15>A3>=10", that could be
AND(A3>=10, A3<15)
or in another notation
(A3>=10)*(A3<15)
- RexMorgan2115Apr 17, 2024Copper ContributorThanks for replying again. That does indeed work! I don't understand how it works but it does.
- SergeiBaklanApr 17, 2024MVP
RexMorgan2115 , you are welcome.
In Excel any number but 1 is equivalent to TRUE if you use it in logical expression. And the opposite, TRUE converted to number is 1. Thus
TRUE*TRUE*TRUE = 1*1*1 = 1 = TRUE
TRUE*FALSE*TRUE = 1*0*1 = 0 = FALSE
In addition, each part of logical expression could use only single condition. Other words,
5<v<10 is of wrong syntaxis. Correct one is combining of two conditions
v>5 AND v<10 which could be translated in Excel formula as
(v>5)*(v<10), or in more formal way
AND( v>5, v < 10)