+ Reply to Thread
Results 1 to 8 of 8

Formula that counts number of unique text values if it meets criteria

  1. #1
    Registered User
    Join Date
    09-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Formula that counts number of unique text values if it meets criteria

    I have been using this function to count the number of unique text values in a data set:
    =SUM(IF(FREQUENCY(MATCH(B2:B10,B2:B10,0),MATCH(B2:B10,B2:B10,0))>0,1))

    It works great if I want to count number of unique text values overall. However, I want to count the occurences of unique text values if they meet specific criteria. (Like a countifs function would if it could count unique text).

    Any ideas?

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

    Re: Formula that counts number of unique text values if it meets criteria

    Tell us what the criteria is.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    09-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Formula that counts number of unique text values if it meets criteria

    It is text criteria:
    Criteria Range: Table[Last Name, First Name]
    Criteria: "Last Name, First Name"

    It is based in the context of how many active employees (unique text values) fall under so-and-so's team (my criteria).

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

    Re: Formula that counts number of unique text values if it meets criteria

    Try something like this...


    Data Range
    A
    B
    C
    D
    E
    1
    Team
    Player
    ----
    Team
    Count
    2
    Blue
    Player4
    Blue
    3
    3
    Blue
    Player4
    4
    Blue
    Player7
    5
    Blue
    Player7
    6
    Blue
    Player9
    7
    Green
    Player5
    8
    Green
    Player5
    9
    Green
    Player6
    10
    Green
    Player6
    11
    Red
    Player1
    12
    Red
    Player1
    13
    Red
    Player2
    14
    Red
    Player2
    15
    Red
    Player3


    This array formula** entered in E2:

    =SUM(IF(FREQUENCY(IF(A2:A15=D2,MATCH(B2:B15,B2:B15,0)),ROW(B2:B15)-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.

  5. #5
    Registered User
    Join Date
    09-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Formula that counts number of unique text values if it meets criteria

    It works! Thank you so much!

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

    Re: Formula that counts number of unique text values if it meets criteria

    You're welcome. Thanks for the feedback!

  7. #7
    Registered User
    Join Date
    02-15-2014
    Location
    Edmonton, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Formula that counts number of unique text values if it meets criteria

    Tony
    How would you modify this formula to look at the criteria in a 2nd column on top of looking in Column A?
    I have a list of people with different certifications that work in different regions. I am currently using your example to give me a count of people per region and it removes the duplicates perfectly.
    =SUM(IF(FREQUENCY(IF(('CMD Certs'!$C$2:$C$20000=$A16),MATCH('CMD Certs'!$A$2:$A$20000,'CMD Certs'!$A$2:$A$20000,0)),ROW('CMD Certs'!$A$2:$A$20000)-ROW('CMD Certs'!$A$2)+1),1))

    I can modify it to give me a count of people with a certain type of certification and that works well too.
    =SUM(IF(FREQUENCY(IF(('CMD Certs'!$E$2:$E$20000=H$15),MATCH('CMD Certs'!$A$2:$A$20000,'CMD Certs'!$A$2:$A$20000,0)),ROW('CMD Certs'!$A$2:$A$20000)-ROW('CMD Certs'!$A$2)+1),1))

    But I need it to give me the count of personnel within a region with a specific type of certification. How can I get both in a single statement

    Thanks in advance
    George

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

    Re: Formula that counts number of unique text values if it meets criteria

    Like this...

    =SUM(IF(FREQUENCY(IF('CMD Certs'!$C$2:$C$20000=$A16,IF('CMD Certs'!$E$2:$E$20000=H$15,MATCH('CMD Certs'!$A$2:$A$20000,'CMD Certs'!$A$2:$A$20000,0))),ROW('CMD Certs'!$A$2:$A$20000)-ROW('CMD Certs'!$A$2)+1),1))

    Still array entered.

+ 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. Formula that counts unique values within a criteria
    By GRACEROUHANA in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-03-2013, 01:20 PM
  2. Count unique values in a column for each row that meets 3 criteria
    By xtomg19 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-18-2012, 12:15 AM
  3. [SOLVED] Count the occurance of a number or text in a range that meets other criteria
    By kaneohe247 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-29-2012, 12:51 PM
  4. Replies: 7
    Last Post: 07-19-2012, 10:22 AM
  5. Counts of unique values with multiple criteria
    By ChristiaanV in forum Excel General
    Replies: 4
    Last Post: 03-09-2011, 12:47 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