+ Reply to Thread
Results 1 to 8 of 8

Matching Two Columns

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    Place, United States
    MS-Off Ver
    Excel 2003
    Posts
    12

    Matching Two Columns

    Hello, I have two tables that contain data relating to people and I'd like to join those tables together. The name of each person is one of the columns contained in each table, so I'd like to use a VLOOKUP to match the rows appropriately. However, I'm running into a weird problem where even when I know there are rows in each table that match (i.e. they are for the same person) the lookup is not working. I don't know what's going on because, for example, I have the name "Jerry" in two cells, say C3 and F3, and when I do the following function:

    =if(C3<>F3,"ERROR","Match")

    the function returns "Error" even though I can see plainly that the cells are identical. Can anyone help me?

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Matching Two Columns

    Hello and welcome to the forum,

    Maybe try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    10-26-2012
    Location
    Place, United States
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Matching Two Columns

    Abousetta,

    Thanks for the reply, I tried the updated formula to no avail. I checked the formatting on each cell too and they are the same... I'm a little baffled.

  4. #4
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Matching Two Columns

    Can you upload your file?

  5. #5
    Registered User
    Join Date
    10-26-2012
    Location
    Place, United States
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Matching Two Columns

    Here is the file, which contains data on baseball player statistics from this season. If you scroll through the file you'll see that there is data for each team and for each team, if you scroll to the right, there are three tables worth of data sitting next to each other. For example, cell F3 has the name 'Jonathan Albaledejo', then all the columns to the right of that are the corresponding data from one table until you get to cell AF3, which is once again 'Jonathan Albaledejo.' This is the start of a second table of data, which goes until cell BF2. Cell BF3 is once again 'Jonathan Albaledejo', and starts the third table.

    My goal is to combine all the data from these tables together. The only sticky point is that the player data isn't always in the same row across tables, as it is in the first row, so I think a VLOOKUP will be necessary unless there is a better way to get to my desired result.

    Thanks again for the help!
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Matching Two Columns

    Yes, there is something wrong here and I can't put my finger on it either. I created a new sheet using the Clean function since you didn't have many formulas. It seems that you copy/pasted from somewhere else and it brought along invisible characters. Maybe try it now.

    abousetta
    Attached Files Attached Files

  7. #7
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Matching Two Columns

    Cell F3 is returning CHAR(32) for the space between the first and last name. Cell BF3 is returning CHAR(160) for the space between first and last name. This is generally caused by imported data from other (non-excel) sources (web, pdf, etc.).

    Here's how to get them to "match"

    In cell CF3 enter this formula and fill down to CF1438: =IF(ISBLANK(BF3),"",TRIM(SUBSTITUTE(BF3,CHAR(160)," ")))
    Then select CF3:CF1438 and copy
    Then select cell BF3 and Paste Special - Values

    Now testing with =IF(F3<>BF3,"ERROR","Match") should return Match.

    Then your lookups should work.

    - Moo

  8. #8
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Matching Two Columns

    another option based on the char(160) which Moo have found

    Using Find and replace


    type =CHAR(160) in any cell then press F9 do not hit enter.Select the value Ctrl+C(which is actually a non-breaking space) . press escape then select the entire column (BF)open find and replace -> paste the copied character ->then go to replace with box -> hit the space bar.

    try now the given formula to you or your formula
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

+ 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