+ Reply to Thread
Results 1 to 6 of 6

Counting values in cells and a range

  1. #1
    Registered User
    Join Date
    06-08-2009
    Location
    Woodbridge, VA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Counting values in cells and a range

    Hello!

    Here is my problem:

    I have a column, we'll say E18:E2500. In the cells in that column are four digit numbers. Some of these cells may have multiple four digit numbers separated by a comma and a space. (example: 2020, 2100, 3120) Some other cells in the column may also share the four digit numbers (I mean duplicates).

    So I'm trying to write a formula to sum and count all the unique values in the cells and in the range.

    This is what i've been trying to use but it counts all the values with no regard to duplicate values:

    =SUM(IF(LEN(TRIM($E$18:$E$2500))=0,0,LEN(TRIM($E$18:$E$2500))-LEN(SUBSTITUTE($E$18:$E$2500," ",""))+1))

    Can anyone help??
    Last edited by jcgroove; 06-08-2009 at 04:28 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Counting values in cells and a range

    Try

    =SUMPRODUCT(--ISNUMBER(MATCH("*"&ROW(INDIRECT("1000:9999"))&"*",E18:E2500&"",0)),ROW(INDIRECT("1000:9999")))

  3. #3
    Registered User
    Join Date
    06-08-2009
    Location
    Woodbridge, VA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting values in cells and a range

    That formula adds up all the values together. I just want to count how many values there are.

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

    Re: Counting values in cells and a range

    Take out the 2nd condition:

    =SUMPRODUCT(--ISNUMBER(MATCH("*"&ROW(INDIRECT("1000:9999"))&"*",E18:E2500&"",0)))
    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.

  5. #5
    Registered User
    Join Date
    06-08-2009
    Location
    Woodbridge, VA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting values in cells and a range

    That worked!

    Thanks!

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

    Re: Counting values in cells and a range

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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