# nested if statements excel

Microsoft Excel 2010
June 16, 2010 at 13:42:46
Specs: Windows 7
 How should I write an if statement for the folloing:IF 0

See More: nested if statements excel

#1
June 16, 2010 at 13:56:24
 What happens if X equals 0 or 90 or 180 or 270 or 360?

Report •

#2
June 16, 2010 at 14:15:55
 This should get you what you asked for.It will return "" (blank) if A1 equals 0 or 90 or 180 or 270 or 360 or 360>A1<0.=IF(OR(AND(A1>0,A1<90),AND(A1>180,A1<270)),"PRINT B",IF(OR(AND(A1>90,A1<180),AND(A1>270,A1<360)),"PRINT S",""))

Report •

#3
June 16, 2010 at 16:28:38
 Thank you thank you thank you. It works very very well. Answering your question about the other cases;it should be ignored. I only care if it is greater or smaller than the value.

Report •

Related Solutions

#4
June 16, 2010 at 17:21:18
 I'm glad I could help.re: ...about the other cases;it should be ignored...Actually, I don't think that you want them to be ignored.The formula I offered did not ignore those cases, it dealt with them by returning a blank cell ("") if none of the other conditions were met.The formula below actually does "ignore" them, by not telling Excel what to return if the other conditions are met.Try it and I think you'll see why you don't want to "ignore" values outside of your ranges.See what happens if you use this formula with a 0 in A1.=IF(OR(AND(A1>0,A1<90),AND(A1>180,A1<270)),"PRINT B",IF(OR(AND(A1>90,A1<180),AND(A1>270,A1<360)),"PRINT S"))

Report •

#5
June 16, 2010 at 18:00:23
 It gave a "FALSE". Do I have to stick with the first formula?I have another question. How to do the following:If the output is "PRINT S", highlight the cell that has "PRINT S" red.If the output is "PRINT B", highlight the cell that has "PRINT B" green.Is my question clear?..... Sometimes I feel like I do not know how to say something?

Report •

#6
June 16, 2010 at 18:25:49
 Of course you should stick the first formula - assuming you want a blank cell when your conditions aren't met.I was simply pointing out the you can't "ignore" the other conditions. You have to tell Excel what to do with them, as I did in the first formula. If you "ignore" them, you'll get a FALSE, which I'm sure is not what you want.As far as Red and Green, look up Conditional Formatting in the Excel Help files and follow those steps. I think Excel 2010 uses the same steps as Excel 2007, but I'm not sure. It should be in the Help files in any case.If you have trouble, come on back, but please post that question in a new thread.

Report •

#7
June 16, 2010 at 18:29:33
 I will try and see. Thank you again.

Report •