+ Reply to Thread
Results 1 to 14 of 14

Make data validation display values from one column and store values from another

  1. #1
    Registered User
    Join Date
    11-01-2011
    Location
    Twente, Nederland
    MS-Off Ver
    Excel Professional Plus 2019
    Posts
    40

    Question Make data validation display values from one column and store values from another

    Hi All,

    In a sheet I have a named range with 2 columns, named "StoreViews".

    ID Description
    1 Dutch B2B
    2 German B2B
    3 English B2B
    4 Dutch Consumer
    5 German Consumer
    6 English Consumer
    7 Dutch
    8 German
    9 English
    10 All Stores

    I would like to reference this named range in a data validation on a second sheet.
    However... I want to display the descriptions and store the ID's of the named range.

    How do I do that?
    If I simply set the data validation to the named range, I get values from both columns.
    Any pointers are greatly appreciated!

    Thanks.
    carpe diem

  2. #2
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Make data validation display values from one column and store values from another

    Could you please upload your sample file with desired result ?

    Regards.

  3. #3
    Registered User
    Join Date
    11-01-2011
    Location
    Twente, Nederland
    MS-Off Ver
    Excel Professional Plus 2019
    Posts
    40

    Re: Make data validation display values from one column and store values from another

    Ok, attached here is an example file.

    The actual data validation in this file now, is on the description column of the named range.
    So this is not the desired end result.

    I have mimicked what it's supposed to do in a screenshot.
    DataValidation.jpg

    I need the Number-values from the ID column to perform future actions, but these numbers alone do not make sense to the user.
    He needs to select a value based on the descriptions.


    I hope my intend is now clear.
    Attached Files Attached Files
    Last edited by pluginguin; 04-11-2022 at 04:54 AM.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,146

    Re: Make data validation display values from one column and store values from another

    To get ID

    =INDEX(ID,MATCH(Workfile!C2,Beschrijving,0))

    "ID" & "Beschrijving" are named ranges
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    11-01-2011
    Location
    Twente, Nederland
    MS-Off Ver
    Excel Professional Plus 2019
    Posts
    40

    Re: Make data validation display values from one column and store values from another

    Hi John,

    I've been trying to get this formula to work inside my data validation, but it doesn't.
    And if I put the formula in column C of the Workfile and set the data validation on the named Range "Description" I get cross reference errors.
    I must be missing something.
    Can you please upload my original file with this formula working?

  6. #6
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Make data validation display values from one column and store values from another

    If I'm not wrong, you want to display text in dropdown and after selection the result is a numbere related to selected text.
    I think you need a vba for your task.

    Please Login or Register  to view this content.
    Regards.


    Note : the vba code is just adhoc , I'm not so good in VBA.
    Attached Files Attached Files
    Last edited by menem; 04-11-2022 at 06:29 AM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,146

    Re: Make data validation display values from one column and store values from another

    It does not work inside Data Validation - not least as you will get a circular reference.

    And you cannot have both a Formula and Value in a cell (only using VBA which will overwrite the formula anyway)

    Formula has to be in its own cell e.g. D2.

  8. #8
    Registered User
    Join Date
    11-01-2011
    Location
    Twente, Nederland
    MS-Off Ver
    Excel Professional Plus 2019
    Posts
    40

    Re: Make data validation display values from one column and store values from another

    Your VBA script solved it Menem!
    Thanks a lot!

  9. #9
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Make data validation display values from one column and store values from another

    If you ok for '2 steps' of dropdown this formula may help

    C2
    =IF(ISBLANK(C2),'Named Ranges'!$B$2:$B$11,INDEX('Named Ranges'!$A$2:$A$11,MATCH(C2,'Named Ranges'!$B$2:$B$11,0)))

    Regards.

  10. #10
    Registered User
    Join Date
    11-01-2011
    Location
    Twente, Nederland
    MS-Off Ver
    Excel Professional Plus 2019
    Posts
    40

    Re: Make data validation display values from one column and store values from another

    Hi Menem,

    I prefer to use your script. It does however have a small issue.
    If I clear cell content in column C I get an error message.
    How do I handle the situation where a populated cell get's cleared, fires the script because the sheet changed, but the new value (nothing) is not present in the "Storeviews" named range?

  11. #11
    Registered User
    Join Date
    11-01-2011
    Location
    Twente, Nederland
    MS-Off Ver
    Excel Professional Plus 2019
    Posts
    40

    Re: Make data validation display values from one column and store values from another

    Solved it myself.

    The script is now this:
    HTML Code: 

  12. #12
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Make data validation display values from one column and store values from another

    Sorry to say, I can't do VBA properly.
    Please wait for another member to help.

    Regards.
    Last edited by menem; 04-12-2022 at 03:56 AM. Reason: That's good ^_^, you're already solved

  13. #13
    Registered User
    Join Date
    11-01-2011
    Location
    Twente, Nederland
    MS-Off Ver
    Excel Professional Plus 2019
    Posts
    40

    Re: Make data validation display values from one column and store values from another

    I thought if I added the extra line of code at the top errors would be prevented. (If Intersect(target, Range("C:C")) Is Nothing Then Exit Sub)

    HTML Code: 
    This extra line prevents errors from occurring when I clear data in column C,
    but if I clear all contents from A, B and C i get the error again.
    error.jpg

    Can someone help me out please?
    Last edited by pluginguin; 04-14-2022 at 04:10 AM.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,146

    Re: Make data validation display values from one column and store values from another

    Try

    Please Login or Register  to view this content.

+ 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. [SOLVED] Form to display other table fields associated with combo box then store those values...
    By southward in forum Access Tables & Databases
    Replies: 2
    Last Post: 12-02-2016, 10:33 PM
  2. [SOLVED] Sort Data, Sum Values, and Store the Values on A New Sheet
    By aviatecar in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-04-2014, 06:30 PM
  3. [SOLVED] Sort Data, Sum Values, And Store the Values on A New Sheet
    By aviatecar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2014, 02:17 PM
  4. [SOLVED] How to display list of values in cells after using data validation drop down?
    By Yadhvi in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-03-2013, 12:15 PM
  5. Replies: 6
    Last Post: 06-07-2012, 02:28 PM
  6. Replies: 4
    Last Post: 06-07-2012, 10:04 AM
  7. Can I Store Values Within a Cell to Make Them Selectable?
    By Ocean Zhang in forum Excel General
    Replies: 2
    Last Post: 05-29-2009, 12:21 PM

Tags for this Thread

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