+ Reply to Thread
Results 1 to 10 of 10

Formula for Counting the Number of Unique Values in a Column but with multiple criteria

  1. #1
    Registered User
    Join Date
    02-16-2011
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 365
    Posts
    21

    Formula for Counting the Number of Unique Values in a Column but with multiple criteria

    Hi I have three columns of data that are relevant to my question:

    Column A: Case ID: - a unique 4-digit number assigned to a specific patient/client that sees either therapist Cobb or Therapist Smith.
    Column B: Therapist Name: - Last name of therapist (i.e. Cobb or Smith)
    Column C: Description, the nature of the transaction (i.e. Session or Payment)
    Column G, Row 2: The number of unique cases that Therapist Cobb saw. There could be multiple sessions per case.

    I am looking for the formula to put in Cell G2 that will allow me to calculate the number of unique cases that Cobb saw. i.e. How many unique case ID numbers are there, where the Therapist column says "Cobb", and where the Description column says "Session"

    I've attached a sample worksheet so you can see what I mean.

    I appreciate your help on this.

    Kind regards,
    Nathan Cobb
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,274

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    Are you still using version 2002?!
    Please let us know the version that this solution needs to work for.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,920

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    Administrative Note:

    Is your forum profile up-to-date and showing ONLY the oldest Excel PRODUCT that you need this to work for?

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The four most recent Excel products are Excel 2019, Excel 2021, Excel 2024 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,920

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    If you have Excel 2021 or above, in G2 copied dow:

    =COUNT(UNIQUE(FILTER($A$2:$A$9,($B$2:$B$9=E2)*($C$2:$C$9="Session"))))

    SPILL version (for 365 or 2024):

    =BYROW(E2:E3,LAMBDA(r,COUNT(UNIQUE(FILTER(A2:A9,(B2:B9=r)*(C2:C9="Session"))))))
    Last edited by AliGW; 06-03-2025 at 12:59 AM. Reason: Workbook added.

  5. #5
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    2,011

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    G2=IF($E2<>"",SUM(IF(FREQUENCY(IF($B$2:$B$9=$E2,IF($C$2:$C$9=$C$2,MATCH($A$2:$A$9,$A$2:$A$9,0))),ROW($A$2:$A$9)-ROW($A$2)+1),1)),"")

    Control +shift+ enter

    copy down
    Last edited by CARACALLA; 06-03-2025 at 02:38 AM.

  6. #6
    Registered User
    Join Date
    02-16-2011
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 365
    Posts
    21

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    I'm using Microsoft Excel 365

  7. #7
    Registered User
    Join Date
    02-16-2011
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 365
    Posts
    21

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    Sorry, its been a while since I last used the forum and didn't realize my profile still showed I used Excel 2002. I'm currently using MS Office 365 and have updated that in my profile.

  8. #8
    Registered User
    Join Date
    02-16-2011
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 365
    Posts
    21

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    Hi AliGW, thank-you so much. This is perfect.

  9. #9
    Registered User
    Join Date
    02-16-2011
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 365
    Posts
    21

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    Thank-you Caracalla, this is really helpful.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,920

    Re: Formula for Counting the Number of Unique Values in a Column but with multiple criteri

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

+ 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: 20
    Last Post: 02-24-2021, 07:26 AM
  2. Counting Unique values with multiple criteria
    By qussai in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-10-2017, 07:10 AM
  3. [SOLVED] Help counting unique values from column meeting multiple criteria
    By Starchild in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-28-2014, 01:25 PM
  4. [SOLVED] Counting Number of Unique Values in a List based on Criteria
    By greencroft in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-03-2014, 04:00 AM
  5. Counting Unique Values on Multiple Criteria
    By buhwheet in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-10-2014, 01:32 AM
  6. Replies: 1
    Last Post: 02-18-2013, 01:46 AM
  7. Counting Unique Values with Multiple Criteria
    By CELIA.NEFF in forum Excel General
    Replies: 10
    Last Post: 02-15-2012, 11:31 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