+ Reply to Thread
Results 1 to 12 of 12

Compare Two Tables and Return Values Only on Rows that Match the other Table

  1. #1
    Registered User
    Join Date
    06-21-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2016, Office 365
    Posts
    48

    Compare Two Tables and Return Values Only on Rows that Match the other Table

    Hi

    I have two tables as below:

    Capture.JPG

    I need to return the values of colum B, C and D of Table A beside Table B where the the Codes match in both tables and skip any row on Table B that does not have a match on Table A.

    Thank you for your help.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    this vlookup would be one way...
    =IFERROR(VLOOKUP($F2,$A:$D,COLUMN(B$1),FALSE),"")
    dragged right and down, assumes table A values are in columns A, B, C and D, you would put it in column J and drag right then down.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    06-21-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2016, Office 365
    Posts
    48

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    Great solution! Thank you.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    You're welcome, glad I could help.
    AND, Thank You for the rep!
    Last edited by Sam Capricci; 08-22-2018 at 10:13 AM.

  5. #5
    Registered User
    Join Date
    06-21-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2016, Office 365
    Posts
    48

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    Quote Originally Posted by Sambo kid View Post
    You're welcome, glad I could help.
    AND, if you are so inclined, adding to my reputation is always welcome.
    How do I do that?

    Also, I noticed another variable that I should have pointed out. Some codes in Table A repeat more than once like 111414 and second instance of any repetition does not display on the formula.
    Can anything be done about that?

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    for the reputation part there is *Add Reputation under each poster's post that you can click on and it will add reputation points.
    As for returning more than one result, yes, that can be done.
    You probably should post a sample spreadsheet with enough samples so we can see what you are dealing with, and your expectations of the results.
    For example, are the second instances in the first table or the second table or both? is a helper column out of the question?
    If a helper column is not acceptable then it may require an array formula.

  7. #7
    Registered User
    Join Date
    06-21-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2016, Office 365
    Posts
    48

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    Thank you. Can't find a way to upload a spreadsheet on here, though.

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    under the quick reply window are three buttons, post quick reply, go advanced and cancel.
    click on go advanced then in the next window part way down is another button "manage attachments", click on that and it will open another window.
    at the top will be browse and, for ease of posting I find it easiest to post my sample on my desktop, but go to the file or desktop and click on it, then ok and ok or whatever the prompts say and it should be uploaded.

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    You might also want to remove the "solved" from this post in case others want to add their formulas too (and in the event I'm not here - cause I do have work to do that I'm paid for ).

  10. #10
    Registered User
    Join Date
    06-21-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2016, Office 365
    Posts
    48

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    Quote Originally Posted by Sambo kid View Post
    You might also want to remove the "solved" from this post in case others want to add their formulas too (and in the event I'm not here - cause I do have work to do that I'm paid for ).
    Browser upload not working. You may get it here https://we.tl/t-Csl2f7Y2G5

    Haven't found where to remove the "solved" mark.

    Thank you again for your help.

  11. #11
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    go to the top of this thread, at the thread tools dropdown at the bottom of the list will be unmark this thread as solved.
    I've got a big work project to focus on suddenly due today so I won't be able to be on for a while. Someone will help you especially if you unmark the post. Good luck.

  12. #12
    Registered User
    Join Date
    06-21-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2016, Office 365
    Posts
    48

    Re: Compare Two Tables and Return Values Only on Rows that Match the other Table

    Hello, just in case you can look back at my pending question, the link for the spreadsheet is below.
    Thank you.

+ 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. Replies: 1
    Last Post: 07-07-2018, 02:52 AM
  2. Replies: 20
    Last Post: 10-16-2015, 09:56 AM
  3. Replies: 2
    Last Post: 07-18-2015, 05:19 PM
  4. [SOLVED] VBA to compare two tables, copy the missing rows from one table to the other
    By adfo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-14-2015, 04:52 PM
  5. Look at multiple criterias to see if table values match values of other tables
    By gaudi93080 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-15-2014, 06:45 PM
  6. Index/Match to return values to compare
    By Iptgfs in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-01-2013, 12:39 PM
  7. Replies: 4
    Last Post: 12-04-2012, 04:45 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