+ Reply to Thread
Results 1 to 9 of 9

IF statement from a combo box

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    IF statement from a combo box

    On Sheet 1, I have a combobox that has 3 options. on sheet 2, i am going to have different formulas from each of those options. Should I be going to format control on the combobox and then linking the combobox box to a cell? Ive done this in the excel doc attached.

    Should I be using the IF function for a formula on sheet 2 that would call the chosen option from sheet 1 and assign a numerical value to it? For instance, if I wanted:

    Red = 1
    Yellow = 2
    Green = 3

    If ive linked the combo box to b2 what would the if statement be? or is there an easier way to do this?

    Thanks
    Attached Files Attached Files
    Last edited by Attrition; 02-10-2014 at 09:38 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: IF statement from a combo box

    I think you are on the right track but it's not clear what result you are looking for. What do you want to happen in each of three cases where the user selects red, yellow, or green? More specifically, what does this mean: "i am going to have different formulas from each of those options"
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: IF statement from a combo box

    well i want a cell on sheet 2 to change values based on the option chosen from the combo box on sheet 1. I tried doing this for a cell on sheet 2 but it didnt work.

    =IF(Sheet1!B2="Red",1,0)

    Any ideas?

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: IF statement from a combo box

    You still haven't said what results you want, but here is the idea:

    =CHOOSE(Sheet1!$B$2,"The user picked Red","The user picked Yellow","The user picked Green")

    Edit: The cell linked to the combo box does not have the value that the user selected, it has an index to that value. If you try to use your combo box, you will see that cell B2 contains 1, 2, or 3 (not "Red", "Yellow", or "Green").

  5. #5
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: IF statement from a combo box

    This issue is im still working out what the results for the options are supposed to be. So i apologize if im being confusing.

    I just tried that and it works for red, but not when the user actually chooses yellow or green. But yes, this is exactly what im looking for!

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: IF statement from a combo box

    Here is your file, see formula added in Sheet2!A1. Works OK for me.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: IF statement from a combo box

    Thanks 6String.

    It seems to only work then I go click on the formula into the cell and press enter. Is there a way to have the value in sheet2!a1 change whenever the combobox value is changed and not having to press enter in sheet2!a1?

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: IF statement from a combo box

    That is not what I see but I am using 2010. I don't know of anything that would make 2003 behave differently. Will it update if you hit F9 instead of editing the cell? If so you may have Autocalculate turned off. Check: Tools > Options > Calculation > Calculation > Automatic.

  9. #9
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: IF statement from a combo box

    thats waht the issue was thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. If then else statement for a combo box
    By LeapingLizard in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-26-2013, 04:38 PM
  2. If statement to change Combo box's Row-source?
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2012, 10:10 AM
  3. If statement for a combo box
    By Amber_D_Laws in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-08-2006, 06:26 PM
  4. IF Statement for Combo Box List
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-22-2005, 10:05 AM
  5. Replies: 0
    Last Post: 09-21-2005, 05:05 PM

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