+ Reply to Thread
Results 1 to 5 of 5

New to Forum: How to Append Column B to another ss using vlookup (or another function)

  1. #1
    Registered User
    Join Date
    10-12-2012
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question New to Forum: How to Append Column B to another ss using vlookup (or another function)

    I have two worksheets and want to return a value of "state" from worksheet 2 that matches the value of "city" in worksheet 1. Simplified example:

    1:
    Phila
    NY
    LA

    2:
    Phila PA
    NY NY
    LA CA

    I went to spreadshet 1, and keyed in =Vlookup(A2, A12:B14, 2) but got random values from column B (e.g., "Phila" "AK"). When I put a $A2 in the expression, I got "PA" for all records, not just the ones in PA.

    Is there a way to do this, either through Vlookup or another function?

    thx

    DMM

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: New to Forum: How to Append Column B to another ss using vlookup (or another function)

    are the values all in 1 cell, or multiple cells?

    post a sample workbook please
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: New to Forum: How to Append Column B to another ss using vlookup (or another function)

    You might also want to consider if you are looking for an exact match then you need to use the 4th argument...

    =VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)
    HTH
    Regards, Jeff

  4. #4
    Registered User
    Join Date
    10-12-2012
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: New to Forum: How to Append Column B to another ss using vlookup (or another function)

    Ok, i added a simple example file. in reality, i have the two tables in separate tabs but i put them in one tab for simplicity.

    re: the 4th parameter jeff mentioned, what IS that?

    thx!

    DMM
    Attached Files Attached Files

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: New to Forum: How to Append Column B to another ss using vlookup (or another function)

    The 4th argument is for the match, exact or not.

    In D2 copied down

    =VLOOKUP(B2,$B$12:$L$20,3,0)

    Look in Excel help for VLOOKUP

    range_lookup Optional. A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match:

    If range_lookup is either TRUE or is omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned.

    Important If range_lookup is either TRUE or is omitted, the values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the correct value.

    For more information, see Sort data.

    If range_lookup is FALSE, the values in the first column of table_array do not need to be sorted.

    If the range_lookup argument is FALSE, VLOOKUP will find only an exact match. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, the error value #N/A is returned.

+ 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