+ Reply to Thread
Results 1 to 10 of 10

Formula for counting the number of occurrences within a range of cells AND Strings help

  1. #1
    Registered User
    Join Date
    01-14-2014
    Location
    Somewhere, Canada
    MS-Off Ver
    Excel 2010
    Posts
    11

    Formula for counting the number of occurrences within a range of cells AND Strings help

    Hi,

    As the title stats, I'm looking for the easiest way to count the number of occurrences within a cell range.

    The formula that I'm currently using is:

    =COUNTIF(D$5:D$8,"a*")

    This counts the number of cells that start with 'a' and returns the sum. It seems to work fine, but when I try to make it look for more values in the range it gives me an error. For example;

    When I want to find multiple values in the range and count them all, I use this formula:

    =COUNTIF(D$5:D$8,OR("a*","b*","c*"))

    Anyone know what I'm doing wrong?
    Last edited by V1gilante; 01-14-2014 at 07:20 PM. Reason: sp error

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    Try using the countifs function

    Look here-->http://www.techonthenet.com/excel/formulas/countifs.php
    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 Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    How about:

    Please Login or Register  to view this content.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    Try this

    =SUM(COUNTIF(D5:D8,{"a","b","c"}))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    01-14-2014
    Location
    Somewhere, Canada
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    Quote Originally Posted by alansidman View Post
    Try using the countifs function

    Look here-->http://www.techonthenet.com/excel/formulas/countifs.php
    I tried using countifs like this:

    =COUNTIFS(D$5:D$8,"a*",D5:D8,"b*",D5:D8,"c*")

    It doesn't seem to work.

    Quote Originally Posted by ConneXionLost View Post
    How about:

    Please Login or Register  to view this content.
    This should work, but I want to see if there is an shorter way of doing this.

    Quote Originally Posted by AlKey View Post
    Try this

    =SUM(COUNTIF(D5:D8,{"a","b","c"}))
    This didn't work either.
    Last edited by V1gilante; 01-14-2014 at 07:43 PM.

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    Try this

    =SUM(COUNTIF(D5:D8,{"a*","b*","c*"}))

  7. #7
    Registered User
    Join Date
    01-14-2014
    Location
    Somewhere, Canada
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    Quote Originally Posted by AlKey View Post
    Try this

    =SUM(COUNTIF(D5:D8,{"a*","b*","c*"}))
    Tried this too, but it only counts 1.

    The result I'm looking for would be similar to the formula:

    =COUNTIF(D$5:D$8,"a*")+COUNTIF(D$5:D$8,"b*")+COUNTIF(D$5:D$8,"c*"

    ******

    I typed it in wrong, you're right alkey, this work. +1
    Last edited by V1gilante; 01-14-2014 at 07:56 PM. Reason: I was wrong, +1 AlKey

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    You are wrong

    in this case formula is:

    =SUM(COUNTIF(A2:A11,{"a*","b*","c*"}))

    A
    B
    2
    ark
    7
    3
    amon
    4
    mark
    5
    stone
    6
    bond
    7
    bottle
    8
    board
    9
    apple
    10
    grass
    11
    cob

  9. #9
    Registered User
    Join Date
    01-14-2014
    Location
    Somewhere, Canada
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    Quote Originally Posted by AlKey View Post
    You are wrong

    in this case formula is:

    =SUM(COUNTIF(A2:A11,{"a*","b*","c*"}))

    A
    B
    2
    ark
    7
    3
    amon
    4
    mark
    5
    stone
    6
    bond
    7
    bottle
    8
    board
    9
    apple
    10
    grass
    11
    cob
    Thanks, I didn't type in "=sum(.....", this work perfectly! +1

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula for counting the number of occurrences within a range of cells AND Strings hel

    Glad it worked for you

    Thanks for the feedback!

    Please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ 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] Counting number of occurrences in cells with numbers separated by a comma
    By Losguapos1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-02-2013, 09:44 AM
  2. Formula to Count the Number of Occurrences of a Text String in a Range
    By poug1903 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-10-2011, 06:49 AM
  3. Replies: 5
    Last Post: 11-19-2010, 03:49 PM
  4. counting occurrences in range of cells
    By gppatnude in forum Excel General
    Replies: 2
    Last Post: 06-30-2007, 02:32 PM
  5. Replies: 0
    Last Post: 08-25-2005, 05:44 AM

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