+ Reply to Thread
Results 1 to 7 of 7

Counting Unique Values

  1. #1
    Registered User
    Join Date
    03-05-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Counting Unique Values

    Is there a simple formula that counts unique values in a column? I have tried the following on one column and it worked but it did not work for other columns. I received the "#DIV/0!" error

    =+SUMPRODUCT(1/COUNTIF(D4:D402, D4:D402))
    Last edited by alansidman; 04-02-2019 at 07:40 PM.

  2. #2
    Registered User
    Join Date
    03-05-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Counting Unique Values

    in addition, i would like the formula to adjust as i add or remove values.

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,594

    Re: Counting Unique Values

    Perhaps the following will help.
    The following array entered formula* will list the distinct numbers: =INDIRECT(TEXT(MIN(IF((Table1<>"")*(COUNTIF(G$3:G3,Table1)=0),ROW(Table1)*100+COLUMN(Table1),6553601)),"R0C00"),0)&""
    *Array entered formulas are confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    The following formula will count the distinct numbers in the list: =COUNTIFS(G4:G1000,"<>")
    Note that the columns containing the numbers are transformed into a table so that numbers may be added without changing the formula.
    Note that the column of distinct numbers may be moved and/or hidden for aesthetic purposes.
    Let us know if you have any questions.
    Attached Files Attached Files
    Last edited by JeteMc; 04-02-2019 at 08:36 AM.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: Counting Unique Values

    Is this the type of sort you are requiring.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-05-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: Counting Unique Values

    In a way yes, but I want to count them numerically, not pull them out as a word. Also, I am counting based on merged cells. The merged cells also were formatted in such a way that I want the ability to filter off the merged cell rather than just cell Q3 in the example below. To create the merged cell I had to identify each row I was using for "NEOLITH" and then I copied and pasted those four cells into a neighboring cells. I then merged those four cells and than copied and did a paste special to keep the merged format the same back into the original cells.

    Q3: NEOLITH
    Q4: NEOLITH
    Q5: NEOLITH
    Q6: NEOLITH

    I have gotten this formula to work but it doesn't exclude the blank cells now.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: Counting Unique Values

    Sorry, I will have to pass on assisting on this one.
    One has learnt by experience NEVER data sort on merged cells.
    It appears to work sometimes, then when your business is relying on the accuracy of the analysis 'BOOM' !
    I am tooooo old to experience the learning curve again.
    torachan

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,594

    Re: Counting Unique Values

    I suggest that you upload a small desensitized sample workbook (not a picture or pasted copy) by clicking on the GO ADVANCED button below the Quick Reply window and then scrolling down to Manage Attachments to open the upload window. Be sure to manually include the expected results so that we have something against which to test formulas/code.
    Let us know if you have any questions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Counting unique values
    By tous0026 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-20-2014, 01:38 PM
  2. [SOLVED] counting unique values in col A against unique value in column B
    By greyscale in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2013, 08:43 AM
  3. Replies: 2
    Last Post: 06-06-2012, 01:44 PM
  4. Replies: 0
    Last Post: 03-08-2012, 12:18 PM
  5. Counting Unique Values
    By james_tang in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-06-2007, 04:43 AM
  6. Counting unique values
    By JK57 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-06-2006, 08:02 PM
  7. Counting Unique Values
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 09-06-2005, 04:05 AM
  8. Counting Unique Values
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM

Tags for this Thread

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