+ Reply to Thread
Results 1 to 8 of 8

Counting and Frequency of String values question.

  1. #1
    Registered User
    Join Date
    06-27-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Counting and Frequency of String values question.

    In column A I have a range of about 4000 string values. (example. abc1231a, abc1231b, etc.). There are duplicates in column a.

    In column B I have another range of values (1a, 1b, etc.), with no duplicates.

    Column A contains longer strings that contain the values in column B. A value in column A will never be an exact match to a value in Column B and there is no uniform delimiter.

    I want to count the frequency that each value in Column B appears in the range of Column A, and display it in column C.

    Any help would be appreciated!

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

    Re: Counting and Frequency of String values question.

    Are you looking for unique counts.. i.e. if there are 2 abc1231a entries does it count as 1 or 2?
    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
    Registered User
    Join Date
    06-27-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Counting and Frequency of String values question.

    Quote Originally Posted by NBVC View Post
    Are you looking for unique counts.. i.e. if there are 2 abc1231a entries does it count as 1 or 2?
    It would count as two.

    example:

    Column A

    abc1231a
    abc1231b
    abc1251a
    wedweqx1c


    Column B

    1a
    1b
    1c
    1d



    Column C (desired count)

    2
    1
    1
    0

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Counting and Frequency of String values question.

    Hi

    Column C (desired count)

    2
    1
    1
    0
    Are you sure that last number should be 0?? Not 1? Why?
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  5. #5
    Registered User
    Join Date
    06-27-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Counting and Frequency of String values question.

    because 1d was found nowhere in the values of column A

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

    Re: Counting and Frequency of String values question.

    Use COUNTIF then

    e.g.

    =COUNTIF(A:A,"*"&B2&"*")

    this counts how many items in column A contain the substring in B2.

  7. #7
    Registered User
    Join Date
    06-27-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Counting and Frequency of String values question.

    Thank you, that did the trick.

    To take that one step further, is there any way to count the occurrence of those substrings and make sure to get a count of only an exact match, ie. When I count '1a' , I don't also want it do count instances of '11a'

    Thanks!

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

    Re: Counting and Frequency of String values question.

    The only thing I can think of is something like:

    =COUNTIF($A:$A,"*"&B2&"*")-COUNTIF(A:A,"*"&LEFT(B2)&B2&"*")

    this counts all of the 1a's including 11a', 111a's and if you have 1a in B2, it will subtract any counts that include a 11a... if B2 had 11a in it, then the 111a's would be eliminated from the count, etc...

+ 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