Counting without double counting
MZ Tools makes life easier for the Excel VBA coder
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Counting without double counting

  1. #1
    Guest

    Default

     
    I have a list of numbers. Some numbers are the same. I want to count how many numbers are in the list. But I don't want to count the same number more than once.

    For instance: 1, 67, 4, 32, 4, 3
    Should count: 5
    The four only gets counted once.

    Any help would be greatly appreciated.
    Thanks

  2. #2
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    81,872
    Post Thanks / Like
    Mentioned
    12 Post(s)
    Tagged
    1 Thread(s)

    Default

    On 2002-03-15 06:56, Anonymous wrote:
    I have a list of numbers. Some numbers are the same. I want to count how many numbers are in the list. But I don't want to count the same number more than once.

    For instance: 1, 67, 4, 32, 4, 3
    Should count: 5
    The four only gets counted once.

    Any help would be greatly appreciated.
    Thanks
    =IF(LEN(A1:A10),SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10)))

    where A1:A10 houses the target numbers.

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary, Alberta Canada
    Posts
    3,336
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default


    1. If you want to specify the specific range
    for the data (revise to fit your info)

    =SUMPRODUCT(1/COUNTIF(A1:A6,A1:A6))

    2. If you want to specify a range
    that may include blank cells, use
    Array formulas such as the following:

    a) =SUM(IF(LEN(rData),1/COUNTIF(rData,rData)))

    b) =SUM(IF(LEN(A1:A100),1/COUNTIF(A1:A100,A1:A100)))

    Enter the Array formulas with Ctrl-Shift-Enter (CSE)


  4. #4
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    On 2002-03-15 06:56, Anonymous wrote:
    I have a list of numbers. Some numbers are the same. I want to count how many numbers are in the list. But I don't want to count the same number more than once.

    For instance: 1, 67, 4, 32, 4, 3
    Should count: 5
    The four only gets counted once.

    Any help would be greatly appreciated.
    Thanks
    With your values in A1:A6 use...

    =COUNT(IF(FREQUENCY(A1:A6,A1:A6),1))

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com