+ Reply to Thread
Results 1 to 5 of 5

Matching cell values found in two columns

  1. #1
    Registered User
    Join Date
    07-15-2009
    Location
    Dallas
    MS-Off Ver
    Excel 2003
    Posts
    5

    Matching cell values found in two columns

    I'm wondering if someone can help save me some manual labor. I have some spreadsheets that have 2 columns by as much as 500 rows (with 2 headers). column A has a userid and column B has number of errors (for that userid). I also have a "top 10 agents with the highest errors" that i get from another report in column E. I would like to have a macro that can match the userid in E with the userid in A and place the corresponding value that is in B, in column F. If the userid from E cannot be found in A, a 0 would be placed in column F for that user.


    A B E F
    0009 5 1400 5
    0500 7 1405 0
    1400 5 3467 8
    3467 8 3490 0
    6900 23 1234 6
    3460 9
    1234 6

    Thanks in advance.
    Last edited by MAN; 11-02-2009 at 06:02 PM. Reason: changing heading

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: help with macro

    Please take a few minutes to re-read the forum rules, and then amend your thread title accordingly.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    re: Matching cell values found in two columns

    Hi,

    no macro required, just a simple VLOOKUP with error checking.

    =IF(ISERROR(MATCH(C2,$A$2:$A$500,0)),0,VLOOKUP(C2,$A$2:$B$500,2,FALSE))

    the formula checks if the value in cell C2 exists in column A. If it does not exist, the MATCH function will return an error, and a 0 will be returned in the cell. If the MATCH does not produce an error, the value has been found and VLOOKUP kicks in to return the value in column B on the row that the search value was found.

    hth

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Matching cell values found in two columns

    Alternatively - use a SUMIF

    F2: =SUMIF($A$1:$A$1000,$E2,$B$1:$B$1000)
    copied down

  5. #5
    Registered User
    Join Date
    07-15-2009
    Location
    Dallas
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Matching cell values found in two columns

    Thanks! just what I needed.

+ 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