+ Reply to Thread
Results 1 to 4 of 4

Counting numbers in one cell

  1. #1
    Registered User
    Join Date
    06-01-2006
    Posts
    36

    Counting numbers in one cell

    I want to be able to count the how many numbers separated by commas are in a given cell. Is there a function that will do that for me?

    If the cell contains 4,6,9,11,15 I want the function to return a value of 5.

    Thanks for any help.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    This should work

    =SUM(LEN(A1)-LEN(SUBSTITUTE(A1,",","")))/LEN(",")+1

    it counts the number of commas in cell A1 and returns 4.Then the +1 adds the extra one.

    The attached site has more help

    http://support.microsoft.com/kb/1876...d=2513&sid=340

    If you need to do this on a regualr basic you might want to look at some code to add a user function. See attached link

    http://www.j-walk.com/ss/excel/tips/tip93.htm

    VBA Noob

  3. #3
    Registered User
    Join Date
    06-01-2006
    Posts
    36
    Thanks a bunch. This will be good homework.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No Problem.

    Enjoy

    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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