+ Reply to Thread
Results 1 to 5 of 5

Using COUNTIF to count multiple instances of data in a single cell

  1. #1
    Registered User
    Join Date
    04-06-2016
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    13

    Using COUNTIF to count multiple instances of data in a single cell

    Hi there, I'm trying to use the countif formula to count all instances of a specific letter within a column.

    The formula I'm currently using is =COUNTIF(Orders!E2:E2033,"*A*") (the

    The problem that I'm running into is that I don't just want a count of how many cells "A" appears in, but the number of times "A" appears in any cell in column E.

    So the instances where someone has ordered more than one of Package A (eg C6) only one A gets counted. Is there a way to alter the formula to return a count of 4 for the example below instead of 3?

    Untitled-1.jpg

    Thanks for your help,
    Emily

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,785

    Re: Using COUNTIF to count multiple instances of data in a single cell

    Data Range
    A
    B
    C
    D
    E
    F
    1
    First
    Last
    Package
    2
    Jane
    Doe
    B,D
    A
    0
    '=(LEN(C2)-LEN(SUBSTITUTE(C2,$D$2,"")))/LEN($D$2)
    3
    A,B,C
    1
    4
    M,N,O
    0
    5
    A,C
    1
    6
    A,A,C
    2

    copy the formula down in column E which is shown in column F
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,427

    Re: Using COUNTIF to count multiple instances of data in a single cell

    Try it like this:

    =SUMPRODUCT(--(LEN(C2:C6)-LEN(SUBSTITUTE(C2:C6,"A",""))))

    Adjust the ranges to suit.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    04-06-2016
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    13

    Re: Using COUNTIF to count multiple instances of data in a single cell

    Thank you! Going off of both of your suggestions I got

    =SUMPRODUCT(LEN(Orders!E$2:E$8)-LEN(SUBSTITUTE(Orders!E$2:E$8,"A","")))

    to achieve what I was trying to accomplish.

    If you see this, Pete, what is the purpose of the double dashes (--) in your formula preceding the first LEN?

    Emily

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,785

    Re: Using COUNTIF to count multiple instances of data in a single cell

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Calling multiple instances of a single userform
    By Sorjas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-29-2014, 08:47 AM
  2. [SOLVED] Copying single instances of multiple names
    By andrewc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-01-2013, 04:56 AM
  3. [SOLVED] Find text between 2 characters with multiple instances in a single string
    By mforbes6186 in forum Excel General
    Replies: 3
    Last Post: 02-09-2013, 11:56 AM
  4. Replies: 2
    Last Post: 01-05-2012, 08:36 AM
  5. Multiple Instances to Single Instance
    By jcholla in forum Excel General
    Replies: 2
    Last Post: 11-16-2011, 04:22 PM
  6. How to count multiple values in a single cell, except zero?
    By iuliandonici in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-14-2011, 07:39 AM
  7. Find Multiple instances of Single Criterion in Row & Return To a Single Col
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 05-09-2006, 10:10 PM

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