+ Reply to Thread
Results 1 to 5 of 5

Data Validation and IF function

  1. #1
    Registered User
    Join Date
    10-10-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    4

    Smile Data Validation and IF function

    I have the attached workbook and I am trying to use Data Validation to fill in the cells H2, H3 and I3 with the information in the Location worksheet. I have setup the States & the City and I am able to get the Data Validation to limit the cities listed based on the selected state. Can I use the IF function in the Data Validation to get cell H3 & I3 empty whenever there is nothing in H2? I tried this =IF(ISTEXT(H2),INDIRECT(H2)," ",) in the source section of the Data Validation window but it is not working.

    Also in cell I3, I am trying to get the values to the right of the cities on the Location worksheet. However, some of the values come up correct and others don't. It just keeps whatever value was there previously. Or I just get #N/A like whenever I select "Georgia" & "Atlanta". This happens for a few other cities.

    Thanks
    Attached Files Attached Files
    Last edited by Edexcel386; 10-11-2011 at 11:09 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Data Validation and IF function

    You need an event macro in your sheet to clear data validation contents.

    Here is an example

    The VLOOKUP in I3 should have a 0 or FALSE as it's 4th parameter to find exact match in an unsorted list.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,366

    Re: Data Validation and IF function

    I would normally use something like:

    =IF($H3="","",VLOOKUP($H3,Location!$D$3:$E$220,2,FALSE))

    You need to make the lookup range absolute, both rows and columns, and the column of the search item absolute if you want to drag across.

    As for the Data Validation, the formula would be:

    List: =IF($H2="","",INDIRECT(H2))

    However, I don't think it will work. Values from dependent lists don't clear when the list they are dependent upon change. I think you'd need VBA to achieve that.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    10-10-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Data Validation and IF function

    That did it. Thanks!!

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Data Validation and IF function

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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