+ Reply to Thread
Results 1 to 10 of 10

Two-condition If formula

  1. #1
    Registered User
    Join Date
    08-08-2008
    Location
    UK
    Posts
    24

    Two-condition If formula

    Hello again!

    I am creating a IF(... formula, here is what i have so far...

    =IF(B3='Max' AND C3='Sell', D3-J17,0)

    I have two drop down boxes, one at B3 and one at C3, i want to D3-J17, but only when B3 = Max and C3 = Sell, otherwise 0 (really instead of 0 im gonna add in more formula for the rest of the drop downs, but for arguments sake lets say 0), what do i do?

    Thanks!
    Max

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =IF(AND(B3="Max",C3="Sell"), D3-J17,0)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-08-2008
    Location
    UK
    Posts
    24
    ah brillo thanks!!

  4. #4
    Forum Contributor
    Join Date
    07-09-2008
    Location
    Dallas
    MS-Off Ver
    2007
    Posts
    121
    Ok, let me see if I can do this quickly/simply.

    Make your first drop box, right-click it, pick 'format control', then go to the 'control' tab. You'll have to define an 'input range' - this is the list of choices you want the user to select from in the drop box. For the sake of this example, I'm putting the list as follows in A1:A3 (it could be anywhere on this or another sheet):

    Max
    Min
    Avg

    Next, you have to select the 'cell link' - this is where the result of the user's choice will be stored - I set this to cell B3, per your example/request). Note that this is not the value itself (i.e. it won't display the text "Max"), it is the numeric spot on the A1:A3 list. Choosing 'Max' from the drop box will result in a 1 in cell B3.

    You'll have to do this for the second drop box as well, with it's own input range and cell link as C3, per your example...

    This will leave you with numeric values in cells B3 and C3.

    From there, your formula could/would be (assuming that 'Max' is the first item in your list, and 'Sell' is the first item in the second list, therefore both putting a numeric value of '1' in cells B3 and C3, respectively):

    =IF(AND(B3=1,C3=1),D3-J17,0)
    Does that help?

  5. #5
    Forum Contributor
    Join Date
    07-09-2008
    Location
    Dallas
    MS-Off Ver
    2007
    Posts
    121
    Quote Originally Posted by NBVC
    Try:

    =IF(AND(B3="Max",C3="Sell"), D3-J17,0)
    How does that work if he's using drop-boxes? Values in B3 and C3 won't actually be "Max" and "Sell", respectively; they'll be a numeric value... Won't they? Maybe I missed something.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by jwhitwell
    How does that work if he's using drop-boxes? Values in B3 and C3 won't actually be "Max" and "Sell", respectively; they'll be a numeric value... Won't they? Maybe I missed something.

    I assumed (and looks like I was right based on the OP's response) that he meant he had Data Validation drop down... not Forms/Controls drop downs...

  7. #7
    Forum Contributor
    Join Date
    07-09-2008
    Location
    Dallas
    MS-Off Ver
    2007
    Posts
    121
    Quote Originally Posted by NBVC
    I assumed (and looks like I was right based on the OP's response) that he meant Data Validation drop down... not Forms/Controls drop downs...
    Ooh, good point - well done.

  8. #8
    Registered User
    Join Date
    08-08-2008
    Location
    UK
    Posts
    24
    yes sorry its data validation drop down, but now i have another problem

    Please Login or Register  to view this content.
    Its complaining that the last AND(...) formula has something wrong with it, but as far as i can see its fine! Any ideas?
    Last edited by NBVC; 08-08-2008 at 01:14 PM.

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You have to many nested functions... Excel 2003 and earlier only allow up to 7 nested functions...

    You can try creating 7 separate IFs and add the results... they should all return 0 except for the one that has the right combo...so when added together you should get the correct result...

    Try:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-08-2008
    Location
    UK
    Posts
    24
    hehe thats works, you are an excel god !

+ 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