+ Reply to Thread
Results 1 to 7 of 7

If quantity is 'this' and list choice is 'that' then ...

  1. #1
    Registered User
    Join Date
    03-30-2010
    Location
    Santa Cruz, CA
    MS-Off Ver
    Excel 2004
    Posts
    2

    If quantity is 'this' and list choice is 'that' then ...

    Hi,

    I am trying to add a function/formula that will make a calculation based on a quantity in one cell and whether "dark" or "white" is chosen from a drop down list in another cell. If the quantity is<13 and the color=white then B8*(C18+C19), If quantity is<13 and the color=dark then B8*(C18+C19+1).

    Here is what I have - and it is wrong -

    =IF(AND(B8<13,B16=white),B8*(C18+C19),0),IF(AND(B8<13,B16=dark),B8*(C18+C19+1),0)

    I am also attaching the spreadsheet. I'm using Excel 2004.

    Thanks for any help,
    Kate
    Attached Files Attached Files

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: If quantity is 'this' and list choice is 'that' then ...

    Text needs to be enclosed in quotes.
    You can nest IF statements, but not concatenate them, i.e your first IF statement closes too early and instead of the 0 use the next IF statement.


    try

    =IF(AND(B8<13,B16="white"),B8*(C18+C19),IF(AND(B8<13,B16="dark"),B8*(C18+C19+1),0))

    cheers

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: If quantity is 'this' and list choice is 'that' then ...

    Try

    =SUM(IF(AND(B8<13,B16="white"),B8*(C18+C19),0),IF(AND(B8<13,B16="dark"),B8*(C18+C19+1),0))
    Attached Files Attached Files

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: If quantity is 'this' and list choice is 'that' then ...

    Marcol, why SUM()? It just needs to be put in proper nested IF syntax.

  5. #5
    Registered User
    Join Date
    03-30-2010
    Location
    Santa Cruz, CA
    MS-Off Ver
    Excel 2004
    Posts
    2

    Re: If quantity is 'this' and list choice is 'that' then ...

    Teylyn - Thank you!! I literally have been changing things for hours to get it right. I was so close, yet so far. Your suggestions fixed the problem.
    Thank you again -

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: If quantity is 'this' and list choice is 'that' then ...

    Apologies teylyn

    A quick-fix without thinking.

    Thanks for pointing that out.

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: If quantity is 'this' and list choice is 'that' then ...

    kfalconer, Marcol's solution works as well, it's just not the most elegant approach. But since your formula was basically two IF statements concatenated with a comma, wrapping them into a SUM() is a possibility (after fixing the text string)

    So, Marcol, apologies not required.

    cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1