+ Reply to Thread
Results 1 to 7 of 7

Count Cells but Cells Contain Multiple Data points

  1. #1
    Registered User
    Join Date
    03-20-2009
    Location
    San francisco
    MS-Off Ver
    Excel 2003
    Posts
    2

    Count Cells but Cells Contain Multiple Data points

    Hi, I have 5 cells below. I would like to figure a way to count how many cells contain the number 1. When I use "Countif" or "frequency", it does not recognize the second and third cells, because these cells have multiple data (1,2) and (1,7,9).

    Any suggestions are appreciated! thanks

    1
    1,2
    1, 7, 9
    1
    9

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count Cells but Cells Contain Multiple Data points

    If those values are in column A, this array formula entered with CTRL-SHIFT-ENTER:

    =SUM(SEARCH(1,A1:A5))

    When you press CTRL-SHIFT-ENTER, you will see braces { } appear around your formula. If you just press ENTER you will break the array and get an error message.
    Last edited by JBeaucaire; 03-20-2009 at 12:58 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-20-2009
    Location
    San francisco
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Count Cells but Cells Contain Multiple Data points

    thanks - I tried it but it did not work and I copied the formula exactly as-is. Including typing ctrl - shift-enter.

    Very much appreciate the help!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Count Cells but Cells Contain Multiple Data points

    My apologies...it was late, don't know what I was thinking.

    Your problem is that the sample you provided is both text and numbers. The only way I could get the proper answer of "4" was to count each separately:

    =COUNTIF(A1:A5,"*1*")+COUNTIF(A1:A5,1)

  5. #5
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Count Cells but Cells Contain Multiple Data points

    Quote Originally Posted by JBeaucaire View Post
    My apologies...it was late, don't know what I was thinking.

    Your problem is that the sample you provided is both text and numbers. The only way I could get the proper answer of "4" was to count each separately:

    =COUNTIF(A1:A5,"*1*")+COUNTIF(A1:A5,1)
    Your formula returns 4, incorrect. Should be 2
    1
    6, 12
    1, 7, 9
    7, 11
    9

  6. #6
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Count Cells but Cells Contain Multiple Data points

    Quote Originally Posted by ilovecake View Post
    hi, i have 5 cells below. I would like to figure a way to count how many cells contain the number 1. When i use "countif" or "frequency", it does not recognize the second and third cells, because these cells have multiple data (1,2) and (1,7,9).

    Any suggestions are appreciated! Thanks

    1
    1,2
    1, 7, 9
    1
    9
    =sum(countif(a1:a8,{1,"* 1","1,*","* 1,*"}))

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

    Re: Count Cells but Cells Contain Multiple Data points

    How about:

    =SUMPRODUCT(--(ISNUMBER(SEARCH(",1,",","&A1:A5&","))))

    assuming 1 appears once per cell
    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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