+ Reply to Thread
Results 1 to 11 of 11

Count numbers only once

  1. #1
    Registered User
    Join Date
    06-03-2011
    Location
    Florida, USA
    MS-Off Ver
    Excel 2013
    Posts
    46

    Count numbers only once

    I have a column of numbers which represent a customer number with some repeated:

    A
    15
    15
    15
    16
    16
    18
    19
    22
    etc

    I want to insert a formula that will count the number of customers i.e. each individual customer number will only be counted once. Thanks.
    Last edited by maymano; 06-05-2011 at 03:13 PM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Count numbers only once

    Here, try this (only for numbers):

    =SUMPRODUCT(IF(FREQUENCY(A1:A10, A1:A10)>0, 1))
    Never use Merged Cells in Excel

  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Count numbers only once

    Try Also,

    =SUM(SIGN(FREQUENCY(A:A,A:A)))
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Count numbers only once

    Or, confirmed with Ctrl+Shift+Enter,

    =SUM(1/COUNTIF(A1:A10, A1:A10))
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Count numbers only once

    shg formula work for text too but it will give errors in case of blank cells...

    Here is slightly improvement:

    =SUMPRODUCT((A1:A100<>"")/COUNTIF(A1:A100, A1:A100&""))

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,336

    Re: Count numbers only once

    Hi maymano,

    Here is a way that uses a helping column. See attached.

    This should work with any combination of numbers or text.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Count numbers only once

    Why use helper column with hundreds COUNTIF formulas after 4 ways without it?

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Count numbers only once

    i like
    =SUM(SIGN(FREQUENCY(A:A,A:A)))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Count numbers only once

    I agree with you...

    I see Haseeb A got his second green flag Congrats and deserved

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,336

    Re: Count numbers only once

    But I like helper columns!

    I think that we sometimes give pretty hard formulas that the OP could not derive on his own. My thinking is that Helper Columns (many times) break the problem into smaller and simpler steps that they may get on there own in the future.

    I used to be a school teacher too.

  11. #11
    Registered User
    Join Date
    06-03-2011
    Location
    Florida, USA
    MS-Off Ver
    Excel 2013
    Posts
    46

    Re: Count numbers only once

    Thanks. Really appreciate all the input!

+ 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