You are here:

# Excel/Excel if statement

Question
I am wanting to total several cells based on the choice of another set of cells.  My knowledge of Excel is limited as I am just beginning to branch out from using Excel for basic functions.

I have my spreadsheet setup as following
C2  D2 E2  F2  G2  I2
Hat  Jersey  Pant  Socks  Warmup Top  Uniform Cost

Each of the above cells has a drop down list
Hat and Socks is Yes, No
Jersey, Pant, Warmup Top is YXS, YS, YM, YL ...

The following represents the cost for each item
B36  \$8.00
B37  \$13.80
B39  \$15.80
B40  \$10.00
B41  \$13.00
B42  \$8.00
B43  \$10.00

I want I2 to be the sum of the items chosen in C2-G2
If C2 = Yes then B36, if not then 0
IF D2 = any of these choices (YXS,YS,YM,YL,YXL) then B37, if nothing is chosen then 0
IF D2 = any of these choices (S,M,L,XL) then B38, if nothing is chosen then 0
If E2 = any of these choices (YXS,YS,YM,YL,YXL) then B39, if nothing is chosen then 0
If E2 = any of these choices (S,M,L,XL) then B40, if nothing is chosen then 0
If F2 = Yes then B42, if No then 0
IF G2 = any of these choices (YXS,YS,YM,YL,YXL) then B42, if nothing is chosen then 0
If G2 = any of these choices (S,M,L,XL) then B43, if nothing is chosen then 0

Next I want to add the results of C2-H2 for a Total uniform cost

I working on this IF Statement but I receive a #VALUE error =IF(OR(D2="YXS","YS","YM","YL","YXL"),B37,0).
This statement works =IF(OR(D2="YXS"),B37,0)
Can a IF / OR statement work based on different choices in one cell vs the contents of different cells.

Also if you could point me to examples to solve the rest of this spreadsheet I would appreciate it.

Bret

If your formula is typed as follows it will work.

=IF(OR(D2="YXS",D2="YS",D2="YM",D2="YL",D2="YXL"),B37,0)

As you can see you just forgot to tell excel that D2 was the cell you were testing in each of the various choices.

The same type of formula will work for your other situations.

The total for the uniform cost should be the following formula

=Sum(C2:H2)

Hope this helps

Richard
Florida
USA
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 Roberts

##### Expertise

Can assist you in most areas of Excel, have been working with it for about 15 years in many types of applications, but primarily in financial and accounting applications. I am a CPA and many client or client problems have necessitated the use of excel. I am not an expert in charting, macros, or pivot tables.

##### Experience

Have been working with Excel for about 20 years primarily in accounting and financial areas.

Education/Credentials
BA, Certified Public Accountant