Excel/if statement

Advertisement


Question
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 am working on this IF Statement but I receive a #VALUE error =IF(OR(D2="YXS",D2="YS",D2="YM",D2="YL",D2="YXL"),B37),IF(OR(D2="S",D2="M",D2="L",D2="XL"),B38,0),IF(D2="2XL",B39),IF(D2="3XL",B40)

How is the best way to find the mistake when using functions?

Thanks in advance = Bret

Answer
this
IF(OR(D2="YXS",D2="YS",D2="YM",D2="YL",D2="YXL"),B37),IF(OR(D2="S",D2="M",D2="L",D2="XL"),B38,0),IF(D2="2XL",B39),IF(D2="3XL",B40)

would be this

IF(OR(D2="YXS",D2="YS",D2="YM",D2="YL",D2="YXL"),B37,0)+IF(OR(D2="S",D2="M",D2="L",D2="XL"),B38,0),IF(D2="2XL",B39,0)+IF(D2="3XL",B40,0)

But what you have written doesn't seem to follow your rules exactly since the rules to return values from B39 and B40 were the same as the rules for B37 and B38 - the assumption being that they represent prices for Pants (E2) vice B37 and B38 being for jerseys (D2).  

so if we go back to your rules (except, for Socks, you say B42 and I believe you mean B41 so I am using B41):

I2: =IF(C2="Yes",B36,0)+IF(OR(D2="YXS",D2="YS",D2="YM",D2="YL",D2="YXL"),B37,0)+IF(OR(D2="S",D2="M",D2="L",D2="XL"),B38,0)+IF(OR(E2="YXS",E2="YS",E2="YM",E2="YL",E2="YXL"),B39,0)+IF(OR(E2="S",E2="M",E2="L",E2="XL"),B40,0)+IF(F2="Yes",B41,0)+IF(OR(G2="YXS",G2="YS",G2="YM",G2="YL",G2="YXL"),B42,0)+IF(OR(G2="S",G2="M",G2="L",G2="XL"),B43,0)

Barring any typos, I think that is what you want.

--
Regards,
Tom Ogilvy  
About Excel
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

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Tom Ogilvy

Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2016 About.com. All rights reserved.