Consulting

Results 1 to 5 of 5

Thread: lookup or match

  1. #1

    lookup or match

    I would like to Look up or match the City/State from column Q & R with the City/State in column T & U and take the County associated with the City/State in column V and and insert the county into column S.

    If no match is found for the City/ State, then leave the County for the City/State blank. Some Cities do not have States. If a City does not have a State, leave County blank.


    Can someone assist, Thank you
    Attached Files Attached Files

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    If you want a macro free solution, you could combine each pair of columns in "helper" columns and use Lookup, otherwise you need VBA. What is your preference?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    I updated Book1 to assist in understanding what I'm trying to achieve. I would like to update the Counties (yellow column) for all City/State in the USA. If no match is found for the City/ State, then leave the County for that City/State blank.

    VBA function/Code would be the preferred method. Thanks
    Attached Files Attached Files

  4. #4
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    Try.

    In Cell S11:
    =IF($R11="","",INDEX($T$12:$V$533,LOOKUP(99999,SEARCH($R11&$Q11,$T$12:$T$53 3&$U$12:$U$533,1),ROW($V$12:$V$533)-ROW($V$11)),3))
    And copied down!
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  5. #5

    Vlookup alternative

    Hi av8tordude, shrivallabha

    Both have same results... the file attached has the vlookup formula

    Happy Excelling!!!

    Best regards
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •