+ Reply to Thread
Results 1 to 5 of 5

Counting Text Values in Same Cell

  1. #1
    Registered User
    Join Date
    12-27-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    17

    Counting Text Values in Same Cell

    How can I have Excel 2007 find and count values in the same cell? I am trying to place the same value in the cel and have it counted multiple times.

    EX.
    SM SA SM Vet Vet E

    It results in each value being counted once and I would like them to be counted multiple times

    SM: 2
    SA: 1
    Vet: 2
    E: 1

    Any help is appreciated.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Counting Text Values in Same Cell

    It's not entirely clear what you're trying to do, but if you want to count how many times a specific sub-string appears then either of these formula should work (with your string in A1):

    =(LEN(A1)-LEN(SUBSTITUTE(A1,"SM","")))/LEN("SM")

    Or

    =SUMPRODUCT(--(MID(A1,ROW(INDIRECT("1:" & LEN(A1))),LEN("SM"))="SM"))

  3. #3
    Registered User
    Join Date
    12-27-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Counting Text Values in Same Cell

    @Andrew-R,

    "SUMPRODUCT" works for a single cell. I need the results for a cloumn in a table. I used the range, but it didn't transfer the results as expected. I may be reading the formula wrong

    (edit)
    Would blank cells effect this?


    I have list of client families that have the same/ similar identifiers
    I'm new to these forums so I'm not really sure how to make a table but I'm going to try to display what I mean...

    Family 1: Vet Vet E SM SA SA SA
    Family 2: Vet E E SA SM OD
    Family 3: Vet E

    The values in the same cell and in different rows. Values are duplicated within the family and also used in other families.

    Right now with "COUNTIF" it collects the values once per family- Vet: 3/ E: 3/ SM: 2/ SA: 2/ OD: 1
    I would like the results to be- Vet: 4/ E:4/ SM: 2/ SA: 4/ OD: 1
    Last edited by wlugo13; 12-27-2012 at 11:31 AM. Reason: As per Forum Rule #12, don't quote whole posts unless necessary-- it's just clutter.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Counting Text Values in Same Cell

    Ah, with you ... a variation on the SUBSTITUTE formula should do the job:

    =SUMPRODUCT(LEN(A1:A5)-LEN(SUBSTITUTE(A1:A5,"Vet","")))/LEN("Vet")

  5. #5
    Registered User
    Join Date
    12-27-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Counting Text Values in Same Cell

    Excellent! I've been working on this and didn't think to use that combination.
    I'll be back if something else glitches.

+ 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