+ Reply to Thread
Results 1 to 7 of 7

Count unique values with a criteria (Excel 2016)

  1. #1
    Registered User
    Join Date
    01-26-2021
    Location
    Luxembourg
    MS-Off Ver
    2016
    Posts
    5

    Count unique values with a criteria (Excel 2016)

    Hello,

    i could use a kind help for a problem i can't solve by myself.

    I'm trying to count unique values for some statistics and i found a little help from the web for the general unique count off a table, which would be for the attached workbook for the basic count of every person name involved in the data like so:

    =SUM(IF(FREQUENCY(MATCH(data[Person],data[Person],0),MATCH(data[Person],data[Person],0))>0,1))
    (black table is called "data", blue table is called "count")

    Besides me not seeing through that formula that works perfectly for what i need, i just crafted together in a "ah this seems to be that one" type of way and it totally gives me the right count as asked.

    BUT now i need a detail added:
    What if i want to consider a count with a criteria from a second column. Which in the example case would be the column "project" and count uniquely what persons work on a specific project and give the results as the red numbers say in the blue "count" table. Would it be possible to add this criteria in the above formula? Or if not, every advice and explanation is welcome!

    I don't have Excel 365, so i don't know about the UNIQUE formula and can't use it in my Excel 2016.

    P.S. i wanted to avoid pivot tables and lists like "advanced filter" or so, please! I just need numbers off my data, no listings

    Thanks,
    Lucy
    Attached Files Attached Files
    Last edited by lucy1990; 10-04-2021 at 06:19 AM.

  2. #2
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Count unique values with a criteria (Excel 2016)

    If you don't mind to use helper column.

    Insert 2 columns between D and E
    in E2 use formula
    =IF(COUNTIFS(B$1:B2,B2,C$1:C2,C2)=1,1,0)

    Then just use countifs in answer tabel (H2)
    =SUMIFS($E$1:$E$9,data[[#All],[Project]],[@Projects])

    Regards.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-26-2021
    Location
    Luxembourg
    MS-Off Ver
    2016
    Posts
    5

    Re: Count unique values with a criteria (Excel 2016)

    Hello menem,

    thx for your reply!

    Adding columns would be a bit long-winded as i have about 100x tables with a lot of data IRL there is no other possible way to extract the values?

  4. #4
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Count unique values with a criteria (Excel 2016)

    F2=IFERROR(SUM(IF(FREQUENCY(IF($C$2:$C$100=$E2,MATCH($B$2:$B$100,$B$2:$B$100,0)),ROW($B$2:$B$100)-ROW($B$2)+1),1)),"")

    control+shift+enter

    copy down

  5. #5
    Registered User
    Join Date
    01-26-2021
    Location
    Luxembourg
    MS-Off Ver
    2016
    Posts
    5

    Re: Count unique values with a criteria (Excel 2016)

    hello Carcalla,

    the first 2 projects show me blank cell and the last one it counts 1, when i do as you say

  6. #6
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Count unique values with a criteria (Excel 2016)

    Sorry

    H2=IFERROR(SUM(IF(FREQUENCY(IF($C$2:$C$100=$G2,MATCH($B$2:$B$100,$B$2:$B$100,0)),ROW($B$2:$B$100)-ROW($B$2)+1),1)),"")

    Control +shift+enter

    copy down

  7. #7
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Count unique values with a criteria (Excel 2016)

    you can also use a SUMPRODUCT approach - this is no more efficient (less so, in fact) but does negate the Array entry requirement

    =SUMPRODUCT(($C$2:$C$9=$E2)/COUNTIFS($B$2:$B$9,$B$2:$B$9&"",$C$2:$C$9,$C$2:$C$9&""))
    committed with Enter
    copied down

+ 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. Replies: 2
    Last Post: 07-30-2018, 02:21 PM
  2. [SOLVED] Count unique values for a particular criteria
    By cadineshkumar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-22-2018, 10:36 AM
  3. [SOLVED] Formula in Excel to count unique values matching criteria
    By Krix in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-15-2016, 11:51 AM
  4. Count Unique values with 2 criteria - Excel 2010
    By mmaya4 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 06-22-2012, 07:28 AM
  5. Count Unique Values with criteria
    By mashley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2010, 02:00 PM
  6. [SOLVED] how to count unique values in excel based on multiple criteria
    By IDBUGM in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-15-2006, 12:10 PM
  7. how to count unique values in excel based on criteria
    By Jorge in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-13-2005, 10:06 AM

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