+ Reply to Thread
Results 1 to 5 of 5

Count list of whole numbers within a cell

  1. #1
    Registered User
    Join Date
    05-16-2018
    Location
    Ohio, USA
    MS-Off Ver
    2013
    Posts
    2

    Count list of whole numbers within a cell

    I have a spreadsheet that tracks people's activities over several weekends. Column A contains their name, column B contains activity one, column C contains activity two, and so on. The weekend number is typed into column B, C, D, depending upon the activity. If a person does the same activity over multiple weekends, the weekend numbers are typed in column B separated by columns.

    Example:
    A1 = Bob B1= 1, 2, 13, 14 C1 = 5

    I am looking for a way to count the number of weekends a person has worked any particular activity. I need a way to calculate that Bob has worked activity one four times (from B1) and activity two (from C1) once. I know there should be a way using the LEN function but all I seem to do is count digits, not whole numbers. Any ideas?

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Count list of whole numbers within a cell

    count the commas and then add one.


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by mehmetcik; 05-16-2018 at 01:18 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Count list of whole numbers within a cell

    something like this? =LEN(B1)-LEN(SUBSTITUTE(B1,",",""))+1+(LEN(C1)-LEN(SUBSTITUTE(C1,",",""))+1)
    how many columns does it have to be, and is the correct to your example answer 5?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    05-16-2018
    Location
    Ohio, USA
    MS-Off Ver
    2013
    Posts
    2

    Re: Count list of whole numbers within a cell

    Sambo, great response, but I had to make a minor tweak in case one of the columns was blank.

    =(IF(ISBLANK($B1),0,LEN(TRIM($B1))-LEN(SUBSTITUTE(TRIM($B1),",",""))+1))+(IF(ISBLANK($C1),0,LEN(TRIM($C1))-LEN(SUBSTITUTE(TRIM($C1),",",""))+1))

    Thanks for your help!

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Count list of whole numbers within a cell

    Great, glad I could help. Wasn't much different than what mehmetcik gave you though.
    If that solved your issue please don't forget to mark the post as solved using the thread tools at the top of this post.
    AND, thank you for the rep!
    Last edited by Sam Capricci; 05-16-2018 at 02:53 PM.

+ 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] count if x numbers present in cell with letters and numbers
    By augr in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-09-2016, 12:54 PM
  2. To count and list the pairs of numbers data help
    By subra2015 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-27-2016, 02:14 AM
  3. Count numbers in a list which match a condition
    By AlexnL12 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-18-2014, 03:18 PM
  4. Replies: 6
    Last Post: 12-22-2012, 05:04 PM
  5. remove irregular count of 0 from a list of numbers
    By sa02000 in forum Excel General
    Replies: 3
    Last Post: 04-12-2011, 07:49 PM
  6. Count numbers in a list if a condition is true
    By sakau2007 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-03-2010, 05:08 PM
  7. [SOLVED] How do I count the instances of numbers in a list?
    By John@NGC in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-18-2006, 04:00 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