+ Reply to Thread
Results 1 to 5 of 5

Compare columns and list a 3rd column with several possible values

  1. #1
    Registered User
    Join Date
    03-05-2015
    Location
    London, England
    MS-Off Ver
    latest
    Posts
    5

    Compare columns and list a 3rd column with several possible values

    Hi,

    I have an Excel sheet with 3 Columns A, B, C:

    I want to check column A for values present (equal) in column C and list corresponding values from column B in Column D.

    I tried the below code, but did not work.

    =IF(ISNUMBER(MATCH(C1,A:A,0)),VLOOKUP(C1,A:B,2,0),"") from here http://superuser.com/questions/74978...a-third-column

    I should note that in column B, there could be (but not necessary) several values corresponding to columns A and C. I have generated a mock-up excel sheet with Columns A,B,C as well as D, where I added the expected results.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: Compare columns and list a 3rd column with several possible values

    i accomplished your expected results with the following vba code:
    Please Login or Register  to view this content.
    as in the attached
    Attached Files Attached Files
    Hope I could help - if your post has been solved don't forget to mark it as such.

    Clicking the * below is a great way to say thanks!

    "Drowning in 10 feet of water isn?t any different than drowning in a million feet. And if you can swim, it doesn?t matter how deep the ocean is. At some level, once you realize you?re in water that?s too deep to stand, you have to have a very different approach," - Joi Ito

  3. #3
    Registered User
    Join Date
    03-05-2015
    Location
    London, England
    MS-Off Ver
    latest
    Posts
    5

    Re: Compare columns and list a 3rd column with several possible values

    Hi,

    Thanks for the help. However, the code did not work correctly. It read only a few values from column B, and than the rest were 0s. I think Excel treated the values as 1 value (one large number) instead of many separated by commas.

  4. #4
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: Compare columns and list a 3rd column with several possible values

    i don't understand. it worked for me. can you upload your sample showing the error?

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Compare columns and list a 3rd column with several possible values

    Here is one solution with array formulas. On a very large dataset this will be slow.
    There is also another solution with a UDF, it probably work better on large datasets since it's not doing unnecessary calculations.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

+ 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: 6
    Last Post: 05-07-2014, 12:13 AM
  2. Replies: 5
    Last Post: 10-26-2013, 01:03 PM
  3. Compare 2 columns and copy new values from the 2nd columns to a 3rd column
    By djarcadian in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-02-2013, 12:18 PM
  4. [SOLVED] Compare two columns and list the unique values in 3rd column
    By jewellove in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-10-2013, 10:40 AM
  5. [SOLVED] Compare 4 column values then insert a 5th columns value to a blank column/cell value
    By JasonKMcCoy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-27-2012, 06:01 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