+ Reply to Thread
Results 1 to 7 of 7

Countifs for Unique Values

  1. #1
    Registered User
    Join Date
    06-13-2011
    Location
    Little Rock, Arkansas
    MS-Off Ver
    Excel 2013
    Posts
    11

    Countifs for Unique Values

    I am wanting to return the number of employees(Col A), which meet two criterias(type((Col B))&location((Col C)).

    Example result: "Sales" for "Little Rock" had 2 unique employees, Jan and Bob, regardless of how many times Jan or Bob were listed with these criteria.Uniquevaluecountifs.xlsx

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Countifs for Unique Values

    D1:

    Please Login or Register  to view this content.
    This is an Array Formula 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. Press F2 on that cell and try again.

    Once the formula has been successfully entered, copy downwards.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

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

    Re: Countifs for Unique Values

    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    Bob
    measurement
    Little Rock
    sales
    Little Rock
    2
    2
    Bob
    fabrication
    Tucson
    3
    Sue
    fabrication
    Tucson
    4
    Sue
    measurement
    Tucson
    5
    Jan
    sales
    Little Rock
    6
    Jan
    sales
    Tucson
    7
    Jan
    sales
    Tucson
    8
    Bob
    fabrication
    Little Rock
    9
    Sue
    measurement
    Tucson
    10
    Jan
    sales
    Little Rock
    11
    Bob
    sales
    Little Rock
    12
    Jan
    fabrication
    Tucson
    13
    Sue
    fabrication
    Tucson
    14
    ------
    ------
    ------
    ------
    ------
    ------
    ------


    This array formula** entered in G1:

    =SUM(IF(FREQUENCY(IF((B1:B13=E1)*(C1:C13=F1),MATCH(A1:A13,A1:A13,0)),ROW(A1:A13)-ROW(A1)+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.

  4. #4
    Registered User
    Join Date
    06-13-2011
    Location
    Little Rock, Arkansas
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Countifs for Unique Values

    I have tried to input this formula as my own but cannot make it work. Could you please proof?(i did hit ctrl shift enter)

    =SUM(IF(FREQUENCY(IF(('[Ajera Info.xlsx]Employee Data'!$I2:$I75000=D22)*('[Ajera Info.xlsx]Employee Data'!$G2:$G75000=AL1),MATCH('[Ajera Info.xlsx]Employee Data'!$A2:$A75000,'[Ajera Info.xlsx]Employee Data'!$A2:$A75000,0)),ROW('[Ajera Info.xlsx]Employee Data'!$A2:$A75000)-ROW('[Ajera Info.xlsx]Employee Data'!$A$2)+1),1))


    Cell D22 is a city name and AL1="*"&G1&"*", where G1 is used as a search box for the user. Currently AL1 is used as pivot filter using VBA and works well for that.

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

    Re: Countifs for Unique Values

    On 75k rows of data this formula will be slow to calculate.

    Maybe this...

    =SUM(IF(FREQUENCY(IF(('[Ajera Info.xlsx]Employee Data'!$I2:$I75000=D22)*(ISNUMBER(SEARCH(AL1,'[Ajera Info.xlsx]Employee Data'!$G2:$G75000))),MATCH('[Ajera Info.xlsx]Employee Data'!$A2:$A75000,'[Ajera Info.xlsx]Employee Data'!$A2:$A75000,0)),ROW('[Ajera Info.xlsx]Employee Data'!$A2:$A75000)-ROW('[Ajera Info.xlsx]Employee Data'!$A$2)+1),1))

    Still array entered.

  6. #6
    Registered User
    Join Date
    06-13-2011
    Location
    Little Rock, Arkansas
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Countifs for Unique Values

    I have not been able to make this work. I will continue to look at it. Thanks for the help.

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

    Re: Countifs for Unique Values

    I'm guessing this is where the problem is...

    You said:

    ...AL1="*"&G1&"*"
    What exactly does that mean?

    What's in G1 and what's in AL1?

    Your sample file doesn't demonstrate/correspond to this requirement.

+ 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. Countifs Unique values by month
    By bbrunof13 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-06-2015, 02:40 PM
  2. COUNTIFS unique values
    By Dan27 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-14-2014, 12:13 AM
  3. countifs for unique values
    By rbenguerel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-31-2014, 07:57 AM
  4. COUNTIFS with Unique Values
    By lefteegunzz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-23-2013, 04:25 PM
  5. Excel 2007 : Using countifs to count unique values
    By AlexZoom in forum Excel General
    Replies: 2
    Last Post: 09-23-2010, 09:41 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