+ Reply to Thread
Results 1 to 16 of 16

Count Unique records

Hybrid View

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2007
    Posts
    18

    Question Count Unique records

    Hi guys,

    So I have this sheet with 5 columns, column B contains codes like 040401, 050401, 060604 etc.. This column runs from B2 to B89(still growing).
    And I want to have a formula to give me an idea on how many unique records I have in column B.

    Thank you in advance!

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

    Re: Count Unique records

    Here, use this:

    Formula: copy to clipboard
    =SUMPRODUCT(--(COUNTIF(B2:B10000,B2:B10000)=1))
    Never use Merged Cells in Excel

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Count Unique records

    Perhaps
    =SUM(IF(COUNTIF(B2:B89,B2:B89)=1,1,0))
    entered as an array formula with Ctrl+Shift+Enter

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

    Re: Count Unique records

    No need for IF

    Formula: copy to clipboard
    =SUM(--(COUNTIF(B1:B100;B1:B100)=1))


    CSE

  5. #5
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Count Unique records

    With this I get a result of '1', so that's not working as the unique results is definitely higher than 70.
    Maybe good to know that the column/codes are 'text' not 'numbers'

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

    Re: Count Unique records

    If you talk aobut 2nd formula it must be entered with Contrl+shift+enter (not just enter)

  7. #7
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Count Unique records

    Does not work either.. I have a mac and tried everything (is supposed to be alt+control+enter)

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

    Re: Count Unique records

    Doesn't matter. Works for text too.

    result:	3
    	a
    	b
    	v
    	c
    	c
    	5
    	2
    	2
    	7
    	a
    	a
    	b

  9. #9
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Count Unique records

    Well it doesn't work in this column..
    If I press enter to insert the formula it gives an error and selects B89..

  10. #10
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Count Unique records

    Enter formula in the formula bar
    Leave the insertion point there
    Click Ctrl+Shift+Enter all at once - Formula is now between curly braces.
    Same procedure each time you edit the formula
    Adding braces manually will not work

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

    Re: Count Unique records

    I don't understand why don't you use formula in post that can be normally entered?!?

  12. #12
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Count Unique records

    Okay this did work in the end, thank you for that!

    The only way I get now that it completely excludes the double values (so for instance the code 123 is present a couple of times in the column, then I want it to be counted as 1, now it doesn't count it at all..).

    How can I do that?

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count Unique records

    Try this array formula**:

    =SUM(IF(FREQUENCY(IF(B2:B100<>"",MATCH(B2:B100,B2:B100,0)),ROW(B2:B100)-ROW(B2)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  14. #14
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Count Unique records

    Maybe try this:

    Formula: copy to clipboard
    =SUM(IF(FREQUENCY(B:B,B:B)>0,1))


    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  15. #15
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Count Unique records

    Okay Thanks, I wanted to try it but as strange as it may sound: I can't find the 'Frecuency' function in my Dutch version of Excel 2011 for Mac. Because it is Dutch all the functions are also Dutch, but I cannot find the equivalent of 'frequency'.. very strange...

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count Unique records


+ 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