+ Reply to Thread
Results 1 to 6 of 6

Autopopulate cell based on info selected in Data Validation list

  1. #1
    Registered User
    Join Date
    12-17-2012
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    57

    Autopopulate cell based on info selected in Data Validation list

    Hi everyone. Sorry for flooding the forum (I've just created another thread), but I'm facing two independent problems.

    Here I'm wondering if there is a way to automatically populate a cell as soon as previous one (with data validation list) has a value selected?

    I know people usually advise to use VLOOKUPS in such cases, however I don't think this applies to my question and let me show you why:

    Cell A1 is Category A, Cell B1 is Category B and Cell C1 is Category C. Each of them are data validated lists and so let's say Cat.A is Country, Cat.B is Province, Cat.C is Store size. So I select in A: England, B: Devon and C: 500 (just a random number to give an example). And so after we have all these 3 values, I'd like cell D1 to automatically show: Plymouth. Cell D1 needs all 3 previous cells to have valid data selected, otherwise it stays blank.

    I suppose you can't achieve that using VLOOKUP. Is there a way to do it using data validation formulas?

    thanks a bunch for any tips.
    Last edited by mintymike; 12-17-2012 at 09:52 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Autopopulate cell based on info selected in Data Validation list

    Hello mintymike,

    You should post your workbook. It will make it easier to provide you with a solution.

    How to Attach a sample workbook:

    When you are in Advanced reply, click on the paperclip to open the upload window.
    View Pic
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,693

    Re: Autopopulate cell based on info selected in Data Validation list

    I agree that it would be most helpful to see the file.

    To answer this question we need to know how you determine that D1 should be Plymouth. It might very well be possible to do this with formulas without VBA.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    12-17-2012
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    57

    Re: Autopopulate cell based on info selected in Data Validation list

    Yes, you're quite right. I've prepared a sample file and attached it to this reply.

    How I determine the cell to be Plymouth (although I've changed cities in the sample) is basic Dependent Data Validation + INDIRECT formula. I've used hints found on Contextures.

    I'm wondering if I can achieve what I want using a formula in the Source of the List data validation.

    Sample.xlsx

  5. #5
    Registered User
    Join Date
    12-17-2012
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    57

    Re: Autopopulate cell based on info selected in Data Validation list

    Hello, fellows? Any thoughts, please?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,693

    Re: Autopopulate cell based on info selected in Data Validation list

    I've been working with this and I'm sure this is a problem that's been solved many times before in various forms. Do a web search on "excel dependent validation list" for a bunch of information. This article is from a particularly good source.

    The strategy involves enumerating all the dependencies. You need a list of all possible countries. For each country you need a list of all possible provinces/states. Then the Province dropdown would be populated based on the country selected; otherwise your user will be able to pick something like USA, Virginia, Liverpool.

    Once you have that organized, then one approach is to create an exhaustive list of all valid combinations, each value in a different column starting in B. In A, you create a key field to uniquely identify each row, such as

    =B2&"+"&C2&"+"&D2

    Then after the user picks all three values, you build a key from that, similar to above. Then you can use VLOOKUP to take the key built from the user choices and look up the key in the list of possible combinations.

    It might be easier to show a sample but the data in your example does not correlate country to province to store size to city, a necessary step to do this regardless of method.

    Of course, this could all be done in VBA as well, but you still need to lay out all the relationships in your data.

+ 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