+ Reply to Thread
Results 1 to 12 of 12

Find matching number in two columns

  1. #1
    Registered User
    Join Date
    06-11-2009
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    9

    Post Find matching number in two columns

    Hello Everyone,
    My first time in this great forum and I have already got lots of resources from the site.

    I want to loop through ID Column and find the matching number in Record No.column, and hightlight the entire row when match is found. The code I am running can only work for one cell at a time, but I want to run one time.


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Xalaal2009; 06-12-2009 at 10:50 AM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,518

    Re: Find matching number in two columns

    Hi there,

    I'm not quite sure what you mean by:

    The code I am running can only work for one cell at a time, but I want to run one time.
    Can you please explain your requirements a bit more?

    Regards,

    Greg M

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Find matching number in two columns

    hi Xalaal2009

    try.....
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Registered User
    Join Date
    06-11-2009
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Find matching number in two columns

    Thanks, Pike.
    This code only selects the entire column "I" but not the corresponding row in column A (ID)

  5. #5
    Registered User
    Join Date
    06-11-2009
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Find matching number in two columns

    Greg M.,
    I meant to say that the macro, as it is right now, is not efficient because I have to run it as many times as the number of rows in column "I".
    Each value in Record No. has a matching value in the ID column. So when match is found, I need it the entire row highlighted of the matched row of Column ID

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Find matching number in two columns

    try this line

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-11-2009
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Find matching number in two columns

    Pike,
    This does not select Matching rows in Column ID, but rather selects matching rows in Column Record No. (I).

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Find matching number in two columns

    Hey Xalaal2009
    replace and try this
    Please Login or Register  to view this content.
    The changes simply change the A's for I's and I's for A's
    It changes the LookInR for LookForR

  9. #9
    Registered User
    Join Date
    06-11-2009
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Find matching number in two columns

    Pike,
    Many thanks - your solution made a difference. Our organziation appreciate that neat solution.

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Find matching number in two columns

    your weclome just happy to help

  11. #11
    Registered User
    Join Date
    06-11-2009
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Find matching number in two columns

    Hello Pike,
    I like to do little improvement of that code you helped out. I want to sort out by background color so I have all the rows with background-color ( colorIndex 4) to be on the top, and then delete the rest of the rows (none- colorIndex 4). Currently, I use a User-defined function that figures out the colorIndex ID & place it in a seperate column. Then I sort out by colorIndex ID DESC.
    Here is the code for function:
    Public Function colval(CellVar As Range)
    colval = CellVar.Interior.ColorIndex
    End Function
    Abdi J. (Xalaal2009)
    Raiser's Edge Database App. Support/DBA
    Children's Hospital Foundation
    Saint Paul, Minnesota, USA
    http://www.araarso.com

  12. #12
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Find matching number in two columns

    Hi Xalaal2009

    Can you please start a new thread

    It helps other when searching for a similar question

+ 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