+ Reply to Thread
Results 1 to 3 of 3

Need help for macro to find and count matches in Excel

  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    Varna,Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    2

    Need help for macro to find and count matches in Excel

    I need to create a macro to do the follow:
    In a Excel table
    A B C
    ------
    a
    b
    c
    d
    i will paste a data in a column C for instance

    A B C
    ------
    a 0 b
    b 0 b
    c 0 f
    d 0

    The result I'm looking for is to find number of matches in A and B and if there is not match to add element to column A as follow:
    A B C
    -----
    a 0 b
    b 2 b
    c 0 f
    d 0
    f 1
    Last edited by Dorian65; 01-20-2013 at 02:37 PM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Need help for macro to find and count matches in Excel

    See the attached file (green cells) for the data that match.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    01-20-2013
    Location
    Varna,Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Need help for macro to find and count matches in Excel

    Quote Originally Posted by oeldere View Post
    See the attached file (green cells) for the data that match.
    Thanks!But actually i'm looking for something like this:

    Dim wb As Workbook, ws As Worksheet, ws2 As Worksheet
    Dim cell As Range

    Set wb = ActiveWorkbook
    Set ws = Sheets("sheet1") 'Column "A" data


    For Each cell In ws.Range("C1", ws.Range("C65535").End(xlUp))
    If ws.Range("A:A").Find(cell, , , xlWhole) Is Nothing Then
    ws.Range("A65535").End(xlUp).Offset(1, 0) = cell
    End If
    Next cell

    But this macro only adds missing data.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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