+ Reply to Thread
Results 1 to 5 of 5

If statement with data validation list

  1. #1
    Registered User
    Join Date
    03-24-2010
    Location
    Phoenix
    MS-Off Ver
    Office 365 E3
    Posts
    21

    If statement with data validation list

    Here's what I would like to accomplish:

    If a specific value is entered in cell C2, then the corresponding value it is looked up in a table containing all validation values and is placed in cell H2; otherwise, if cell C2 is empty OR does not match a specific value in C2, the a validation list is available to choose from.

    Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If statement with data validation list

    This is actually two separate things.

    1) Create a normal VLOOKUP formula in H2. Something like:

    =VLOOKUP(C2, Sheet2!A:B, 2, 0)
    or
    =IFERROR(VLOOKUP(C2, Sheet2!A:B, 2, 0), "")

    The point here is to have the lookup occur if/when C2 is used an a lookup value exists.

    2) Next, apply a Data Validation setup of:

    Allow: List
    Source: =IF(LEN(C2)=0, MyList)


    -------------------

    These operate independently.

    If C2 is not empty, the formula will attempt to do the lookup for you and display the result.

    If your data validation is setup correctly and C2 is empty or the lookup formula failed to find anything, the "MyList" range of options will appear as a drop down.

    NOTE: If you actually USE the drop down to make a selection, then the formula is forever gone from that cell.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,696

    Re: If statement with data validation list

    Pl upload file with expected result.

  4. #4
    Registered User
    Join Date
    03-24-2010
    Location
    Phoenix
    MS-Off Ver
    Office 365 E3
    Posts
    21

    Re: If statement with data validation list

    This seems to work for the first row. I get the drop down for the data validation list, but all rows below kick out a data validation error and I can't pull the drop down:

    Field Type Information
    H4
    Data Type: List
    Restriction:
    Value must match one of the listed items.
    Blanks will be ignored and are automatically valid.

    Any thoughts?

    Thanks!

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If statement with data validation list

    I would have to look at your workbook to see what was wrong.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

+ 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. Combining If statement and data validation (non-list)
    By zangana in forum Excel General
    Replies: 0
    Last Post: 08-07-2012, 07:54 AM
  2. Performing a Nested if statement with a drop down data validation list
    By THKUCOMEAGAIN in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-07-2012, 07:58 AM
  3. Validation List with If statement
    By snikrs11 in forum Excel General
    Replies: 2
    Last Post: 03-04-2011, 01:25 PM
  4. IF statement for data validation list
    By Lassie in forum Excel General
    Replies: 2
    Last Post: 01-01-2011, 11:27 PM
  5. Can a data validation list be used as part of if statement
    By mkmed in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-28-2008, 03:01 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