+ Reply to Thread
Results 1 to 7 of 7

Dropdown list depending on another dropdown list and second condition

  1. #1
    Registered User
    Join Date
    04-09-2020
    Location
    Slovenia
    MS-Off Ver
    2016
    Posts
    16

    Dropdown list depending on another dropdown list and second condition

    Hello,

    I need help with an excel formula, which would really help me with my work and I just can't figure it out.

    Example:
    I have objects A and B. Each one of them can be small or large. I would like the color to be a drop down list, that depends on the drop down chosen in object and the certain column (small, large).

    Capture1.PNG

    I would need a following formula: if I choose from dropdown list the object A, than in the column Small, it would give me the options (dropdown) to choose either Black or Blue and in the column Large the options for Red or White.
    If I choose from dropdown list the object B, than in the column Small, it would give me the options (dropdown) to choose either Black or green and in the column Large the options for Blue or yellow.

    Capture.PNG


    I hope you understand, what I need.

    I would really appreciate your suggestions.


    Shanaya
    Last edited by Shanaya; 04-13-2020 at 11:37 AM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Dropdown list depending on another dropdown list and second condition

    I have created a drop down in A1, B1, C1

    A1 uses the list A, B
    B1 uses the List Small, Large
    C1 uses the range M1:M2

    Then I put this formula in M1
    =IF(A1&B1="ASmall","Black","") & IF(A1&B1="ALarge"," Red","")&IF(A1&B1="BSmall","Black","")&IF(A1&B1="BLarge","Blue","")

    and this formula in M2
    =IF(A1&B1="ASmall","Blue","") & IF(A1&B1="ALarge","White","")&IF(A1&B1="BSmall","Green","")&IF(A1&B1="BLarge","Yellow","")
    Attached Files Attached Files
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    04-09-2020
    Location
    Slovenia
    MS-Off Ver
    2016
    Posts
    16

    Re: Dropdown list depending on another dropdown list and second condition

    Thank you for such a quick reply, but I don't think this would work, because in the actual table, I have 512 possibilities (512 rows).

    I attached my Example document. In Sheet1 if I choose from column A the object A, I would like in column B (Small) a drop down list from Sheet "Dropdown" and column "Colour" that applies to both conditions: Object = A, Size = Small
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Dropdown list depending on another dropdown list and second condition

    I would use a Macro.

    Right Click on Sheet1 at the bottom of excel and select view code.
    Paste this code into the module that opens and close it.

    Please Login or Register  to view this content.

    Then Paste this into a normal macro module and close it.

    Select "Dropdown" then select "Sheet1" to run the Macros

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 04-10-2020 at 04:25 PM.

  5. #5
    Registered User
    Join Date
    04-09-2020
    Location
    Slovenia
    MS-Off Ver
    2016
    Posts
    16

    Re: Dropdown list depending on another dropdown list and second condition

    mehmetcik, you've helped me a lot, just by posting to use a macro.
    I'm quite a beginner in excel, I know and use the basic functions and before your post, I never even heard of macros.
    Over these few days, I've googled a lot about VBA and macros and I managed to record, what I want excel to do and it's actually working

    In the cell B10 I have a dropdown. If I select a certain Word from this drop down, I'm going to run a specific macro, if I select another, it will run another macro with this code, which I found online:

    Please Login or Register  to view this content.
    I just have a little problem. The code I recorded is meant for the recorded row only (row 10). I would need the code to be changed, so that if I run it in cell B20, it should do the recorded procedure in row 20 only, if I run it in cell B145, it should do the recorded procedure only in row 145.
    What do I need to change in the code?
    Instead of for example "Range("D10").Select" do I have to write Range Column D? But this way excel would use the macro in the intire column at once, wouldn't it?

    The code:

    Please Login or Register  to view this content.
    And how do I than set the "Run" macro for the whole column B?
    Last edited by Shanaya; 04-13-2020 at 04:09 AM.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Dropdown list depending on another dropdown list and second condition

    Administrative Note:

    Hi

    The modification is quite easy. But you need to insert Code Tags.


    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

  7. #7
    Registered User
    Join Date
    04-09-2020
    Location
    Slovenia
    MS-Off Ver
    2016
    Posts
    16

    Re: Dropdown list depending on another dropdown list and second condition

    Never mind, I got it with ActiveCell instead of Range.

    mehmetcik, thank you for the tip

+ 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. Replies: 5
    Last Post: 11-15-2018, 11:02 AM
  2. Use or not use a dropdown list depending on another cell value
    By JCMus in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-20-2014, 05:30 AM
  3. [SOLVED] Create different graphs depending on dropdown list
    By Candbapt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-31-2013, 10:00 AM
  4. Return Data depending on dropdown list
    By GenericPat in forum Excel General
    Replies: 2
    Last Post: 11-02-2012, 04:20 PM
  5. Replies: 0
    Last Post: 08-22-2012, 03:52 PM
  6. Replies: 21
    Last Post: 12-02-2009, 03:27 PM
  7. Date dropdown list and a Time dropdown list in outlook
    By L_ter in forum Outlook Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2009, 02:33 AM

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