+ Reply to Thread
Results 1 to 3 of 3

Best way to count variable number of text strings?

  1. #1
    Forum Contributor
    Join Date
    01-25-2010
    Location
    Virginia
    MS-Off Ver
    Excel 2013
    Posts
    104

    Best way to count variable number of text strings?

    Attached is a sample file with 3 worksheets. The worksheet, Strings of Interest, has a list of strings that I need to get counts of from the data in the worksheet, Raw Data. I'd like to have a third worksheet like what I'm showing in this file as the sheet, Summary Data. The Summary Data sheet shows the number of occurrences of each String of Interest in the Raw Data sheet.

    I know how to create a helper column to count for each unique value, and to then sum all the occurrences, but that feels inefficient. My Raw Data sheet could have anywhere from 500 records, to 40,000 records. My "Strings of Interest" could change somewhat frequently over time. I have lots of files in which I need to do this same thing.

    What is a better/more efficient way to do what I'm trying to do?
    Last edited by SueWithQuestion; 08-22-2011 at 09:48 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Best way to count variable number of text strings?

    If you remove the = signs from the column A entries, then in B2 enter:

    =COUNTIF('Raw Data'!A:A,"*"&A2&"*")

    copied down to easily get count of each item
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Best way to count variable number of text strings?

    Using your sample workbook...on the Summary Data sheet

    This regular function begins the list of "Strings of Interest"
    Please Login or Register  to view this content.
    and this regular formula returns the count of the Col_A string from the Raw Data sheet
    Please Login or Register  to view this content.
    Copy those formulas down as far as you need.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

+ 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