+ Reply to Thread
Results 1 to 3 of 3

count the number of repeats

  1. #1
    Registered User
    Join Date
    06-13-2011
    Location
    Chicago,Illinois
    MS-Off Ver
    Excel 2003
    Posts
    1

    count the number of repeats

    hey guys,
    I'm looking to count how many times a certain string is repeated in a column and place the number in an adjacent cell to the first instance then delete the other instances. The really tricky part for me is that the string or thing I'm searching for will always be different so I cannot specify what to search for. I have tried to simplify the searching by sorting the column, this means I really only have to find the first and last instance of the repetition.

    I've come up with some code that will run through the column and compare the cells based on their contents but I'm having issues trying to store the first and last instance of the string and then counting it.

    Here's what I have so far, however if there is a shorter more efficient way to do this I'm all for it

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: count the number of repeats

    Hi,

    The sub is called in "test" in this example, please pay attention to the parameters !

    please try this:
    Please Login or Register  to view this content.
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: count the number of repeats

    Place your strings in column A
    Leave Columns B and C Empty
    Then Run this Macro

    Please Login or Register  to view this content.

+ 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