Forum Discussion
cwhite1918
Oct 23, 2023Copper Contributor
Writing an ELIF statement with multiple ANDs
Hi all, I'm working on trying to write an ELIF statement that evaluates with multiple ANDs. I'm struggling with the syntax, and whether I should be using IFS, XLOOKUP, or something else. For the...
- 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)
RexMorgan2115
Apr 17, 2024Copper Contributor
Thanks for replying again. That does indeed work! I don't understand how it works but it does.
SergeiBaklan
Apr 17, 2024Diamond Contributor
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)