+ Reply to Thread
Results 1 to 13 of 13

Counting the occurrences of a digit

  1. #1
    Registered User
    Join Date
    06-18-2014
    Location
    Ph Is
    MS-Off Ver
    2007
    Posts
    30

    Counting the occurrences of a digit

    Is there a function in MS Excel that counts the occurrences of a digit? Len counts the number of characters in a cell but that's different.
    using Len on 123456789 gives 9
    but I need something like
    Digit Count
    1 1
    2 1
    3 1
    4 1
    5 1
    6 1
    7 1
    8 1
    9 1

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Counting the occurrences of a digit

    A
    B
    C
    1
    Digits
    Entire Count
    Incremental Count
    2
    1
    1
    1
    3
    2
    2
    1
    4
    3
    1
    1
    5
    4
    1
    1
    6
    5
    2
    1
    7
    6
    1
    1
    8
    7
    1
    1
    9
    8
    1
    1
    10
    9
    1
    1
    11
    2
    2
    2
    12
    5
    2
    2

    B
    C
    2
    =COUNTIF(A:A,A2)
    =COUNTIF($A$2:A2,A2)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Counting the occurrences of a digit

    Let say your given number is in A11
    Criteria digit starts from A1
    In B1:
    =LEN($A$11)-LEN(SUBSTITUTE($A$11,A1,""))
    Drag down
    Quang PT

  4. #4
    Registered User
    Join Date
    06-18-2014
    Location
    Ph Is
    MS-Off Ver
    2007
    Posts
    30

    Re: Counting the occurrences of a digit

    I may have accidentally left out some details. This the setup and I want to count all digits shown.
    Book01.xlsx

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Counting the occurrences of a digit

    Your requirement in Post 1 is not match with the file attached in Post 4
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Counting the occurrences of a digit

    With a pivot table.

    I made it for count and sum of the data.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  7. #7
    Registered User
    Join Date
    06-18-2014
    Location
    Ph Is
    MS-Off Ver
    2007
    Posts
    30

    Re: Counting the occurrences of a digit

    Quote Originally Posted by nflsales View Post
    Your requirement in Post 1 is not match with the file attached in Post 4
    It does, arguably. In post one I was asking for the count of the digits. In post 4, I added the condition that the data are in multiple columns.

    Quote Originally Posted by oeldere View Post
    With a pivot table.

    I made it for count and sum of the data.

    See the attached file.
    This counts numbers, not digits.

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Counting the occurrences of a digit

    Then what is your requirement?

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Counting the occurrences of a digit

    show us a small excel file, without confidential information.

    please also add the expected result in your file.

  10. #10
    Registered User
    Join Date
    06-18-2014
    Location
    Ph Is
    MS-Off Ver
    2007
    Posts
    30

    Re: Counting the occurrences of a digit

    Here's a screenshot

    Screenshot.jpg
    Last edited by Volle12; 10-29-2015 at 05:20 AM.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,404

    Re: Counting the occurrences of a digit

    Quote Originally Posted by Volle12 View Post
    Here's a screenshot

    Attachment 427614
    What are the expected results in column E?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Counting the occurrences of a digit

    This place in E2 to count number(in D2) exist in A2:A20

    =SUMPRODUCT(LEN($A$2:$A$20)-LEN(SUBSTITUTE($A$2:$A$20,D2,"")))

    Drag down

  13. #13
    Registered User
    Join Date
    06-18-2014
    Location
    Ph Is
    MS-Off Ver
    2007
    Posts
    30

    Re: Counting the occurrences of a digit

    Quote Originally Posted by bebo021999 View Post
    This place in E2 to count number(in D2) exist in A2:A20

    =SUMPRODUCT(LEN($A$2:$A$20)-LEN(SUBSTITUTE($A$2:$A$20,D2,"")))

    Drag down
    This worked. Thanks a lot :D

+ 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. Formula for counting occurrences
    By jerrygossner in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-04-2015, 10:28 AM
  2. Counting Occurrences
    By RiaanDeysel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-28-2015, 11:52 AM
  3. [SOLVED] counting occurrences
    By kri54sub in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-11-2013, 01:01 PM
  4. Counting occurrences within each month
    By Fatosi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-14-2012, 04:26 PM
  5. Counting occurrences
    By HaydenB in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 10-30-2010, 04:26 PM
  6. Counting occurrences of a value within a range
    By amyg in forum Excel General
    Replies: 7
    Last Post: 11-07-2008, 12:16 PM
  7. [SOLVED] Counting number occurrences
    By thermometer in forum Excel General
    Replies: 3
    Last Post: 06-06-2006, 03: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