# Formula chaos (IF, OR, AND) Microsoft Office excel 2007 home & stude...
August 9, 2010 at 09:25:59
Specs: Windows 7
 Hello, people. You helped me perfectly last time, and I'm just in a bit of a rut again, as I've been cluttering about with this formula for an hour. I'm not an expert, to say the least.Anyways, I'd like to have the following happen:If A10 contains a number, write "Hello" to B2.If either A2, A3 or A4 TOGETHER with C2 contains a number, write hello to B2.By logic reasoning I came up with this for my second line.=IF(AND(OR(ISNUMBER(A2);ISNUMBER(A3);ISNUMBER(A4))*ISNUMBER(C2));"Hello";"Blargh)Now, this works quite all right. But how can I get the formula to regardless of values in C2, A2, A4 and A4 display "hello" if there is a number in A10?I've experimented with using another (OR), but I'm not sure where to put it, as my formula is screwing up hard on me.I was thinking something like: =IF(AND(OR(OR(ISNUMBER(A2);ISNUMBER(A3);ISNUMBER(A4))ISNUMBER(A10))*ISNUMBER(C2));"Hello";"Blargh)Thanks for making me understand a bit more. :) See More: Formula chaos (IF, OR, AND)

#1 August 9, 2010 at 09:41:44
 Why not start with the simplest case first: Is A10 a number?=IF(ISNUMBER(A10),"Hello",IF(AND(OR(ISNUMBER(A2),ISNUMBER(A3),ISNUMBER(A4)),ISNUMBER(C2)),"Hello","Blargh")An IF statement stops checking the conditions as soon as it finds something that is TRUE, so check A10 first.

Report •

#2
August 9, 2010 at 09:45:37
 Oh God, I can't understand how I didn't think about using two IF's. Thanks a million, it works like a charm!

Report •

#3 August 9, 2010 at 09:54:50
 It can also be done with a single IF, but it might be a bit more confusing:=IF(OR(ISNUMBER(A10),AND(OR(ISNUMBER(A2),ISNUMBER(A3),ISNUMBER(A4)),ISNUMBER(C2))),"Hello","Blargh")Again, the IF will stop as soon as a TRUE is found, which could be the ISNUMBER(A10) within the first OR.

Report •
Related Solutions 