You are here:

# Excel/IF AND / OR STATEMENTS

Question
Cell A1 can be either 50, 75, 100
Cell A2 can be either 50A, 50B, 75A, 75B, 100A, 100B
Cell A3 is to return the result of:
If Cell A1 is 50 and Cell A2 is either 50A or 50B, then message "OK", If Cell A1 is 75 and Cell A2 is either 75A or 75B, then message "OK", If Cell A1 is 100 and Cell A2 is either 100A or 100B then message "OK", otherwise "Thickness must match"

I can get this to work if I only use the one set of items, ie. 50, 50A and 50B but once I introduce the 75 and 100 it falls down

You have to use your IF, AND, and OR functions properly. It's easier if you break it down into multiple columns. For example, in B1, I would put the following:

=AND(A1=50,OR(A2="50A",A2="50B"))

That checks for the first value. Now do the same thing for the other two values in C1, and D1. Now you will have three TRUE or FALSE values. In E1, you can say:

=IF(AND(B1,C1,D1),"OK","Thickness must match")

And there you go. It would be a big mess to put that all together into one formula. You COULD do it, but this is much easier to read.

Be sure to visit my web site and watch my FREE 90-minute Microsoft Excel Video Tutorial

Cordially,
Richard Rost
599CD Computer Training
Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Thank you. That is very easy for me to understand.

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Richard Rost

##### Expertise

 I am the author of The Complete Idiot's Guide to Excel 2010.   I am happy to answer any questions about Microsoft Excel. If you have an Excel problem, let me help you with it. Also, please be sure to check the Excel Tips & Tricks and Excel Tutorials sections of my web site.   You can also watch my complete Excel 2010 For Beginners tutorial online which is over 90 minutes of FREE videos and an eBook.

##### Experience

I have been using Microsoft Excel since the very early Windows 3.1 versions. I have been teaching Microsoft Excel in the classroom since 1994, and online through computer tutorials since 2002.

Organizations
I have been volunteering on AllExperts in the categories of Microsoft Access, Visual Basic, and Weight Loss for years.

Publications
I am the author of The Complete Idiot's Guide to Excel 2010. I have created a line of computer tutorials online at www.ExcelLearningZone.com and www.599CD.com/Excel.

Education/Credentials
Personally, I am self taught. I've learned everything I know from books and trial & error. If I don't know the answer, I know how to find it.

Past/Present Clients
I have over 20,000 happy clients worldwide.