Forum Discussion
Multiple IF, AND, OR in excel won't work
- Aug 12, 2022
The problem as fixed above is that the 2nd IF statement has a big OR statement as the conditional but no statements for the if true or if false result:
=IF($H$6<F11-15,1, IF( OR( IF( AND($H$6>F11,A12<0,B12<0,C12<0,D12<0,E12<0),0,1), (IF(AND($H$6>F11,A12>0,B12<0,C12<0,D12<0,E12<0),0,1)), (IF(AND($H$6>F11,A12>0,B12>0,C12<0,D12<0,E12<0),0,1)), (IF(AND($H$6>F11,A12>0,B12>0,C12>0,D12<0,E12<0),0,1)), (IF(AND($H$6>F11,A12>0,B12>0,C12>0,D12>0,E12<0),0,1)) ), {if true do this}, {if false do this} ) )alternatively maybe this would work for you:
=IFS($H$6<F11-15,1, OR($H$6<=F11,E12>=0),{true}, A12<=0,{true}, B12<=0,{true}, C12<=0,{true}, D12<=0,{true}, TRUE, {false} )again I will not assume what value you wanted for the result of that IF() statement being TRUE or FALSE
Gidday magerr999
Thanks for that info. Yeah, I discovered I was using the OR function incorrectly. Here's the update I made to it that works:
=IF($H$6<=F11-15,1,IF(OR(AND($H$6>F11,A12<0,B12<0,C12<0,D12<0,G12<0),AND($H$6>F11,A12>0,B12<0,C12<0,D12<0,G12<0),AND($H$6>F11,A12>0,B12>0,C12<0,D12<0,G12<0),AND($H$6>F11,A12>0,B12>0,C12>0,D12<0,G12<0),AND($H$6>F11,A12>0,B12>0,C12>0,D12>0,G12>0))=TRUE,1,0))
but it's blooming long. I think mtarler has come up with the best and shortest version I just need to test it properly and try understand how it works! LMAO
Haven't tried the value() function yet. Do you place the alpha values inside the brackets? And is it a case of A=1, B=2 etc?
i keep looking at your original formula and I still can't see anything wrong with it, I really don't. I think it's fine. It might have something to do with your data. Or believe it or not, sometimes the formula just won't work and there is nothing wrong with it. I found that if I retyped it in a different cell it will then work fine. good luck.
- magerr999Aug 13, 2022Copper ContributorHello again, 🙂 I still think your orginal formula is just fine. The problem lies with the data. Of course I could be wrong and probably am. So I ran a test. I shortened your original formula up a bit (I hate typing), and your formula worked fine. Here's my test. best to drop it into excel. bob
a b c d e f g h i
27
28 test below== false =IF(AND(E30,E31),"true","false")
29 e29 FALSE =E32<F32
30 e30 FALSE =AND(E32<F32,E32<G32)
31 e31 FALSE AND(E32<F32,E32>G32)
32 orig=== "=IF(E32<F32,1,
IF(OR(AND(E32<F32,E32<G32),
AND(E32<F32,E32>G32)), ""True"", ""False""))" ====>> 3 2 4 = formula answers
33 e29 e30 e31
34
35
36
37- magerr999Aug 15, 2022Copper Contributor
value(a2), value(b2)...... it takes what might be a text and changes it to a numeric value. but what might be easier is to first check your column or row of data using the type command, type(a2), .... it will tell you whether your data is 1 for numeric or 2 for text.
I again looked at your original formula and still don't see anything wrong with it. But I've been wrong before. I would go along with the person 's formula that works for you.
odds are, if you retyped the formula from scratch, it will work for you. imo, bob