+ Reply to Thread
Results 1 to 3 of 3

Unique Count Based on Certain Criteria

  1. #1
    Registered User
    Join Date
    10-08-2014
    Location
    Birmingham, AL
    MS-Off Ver
    2013
    Posts
    2

    Unique Count Based on Certain Criteria

    Hello! I appreciate in advance anyone who helps me with this.

    In this example, I have one sheet with each individual charge from different doctors. Column A is the doctor, column B is the charge code, and column C is the claim number. Since a claim can have multiple charge codes, there are many duplicate claim numbers in column C.

    What I am trying to do on a separate sheet is create a formula to pull the number of unique claims for each doctor. I came across the following formula on another site:

    =SUM(IF(FREQUENCY(IF(LEN('reference sheet'!C:C)>0,MATCH('reference sheet'!C:C,'reference sheet'C:C,0),""), IF(LEN('reference sheet'C:C)>0,MATCH('reference sheet'C:C,'reference sheet'C:C,0),""))>0,1))

    This formula successfully returns the number of unique claim numbers, but what I need to do now is essentially insert "if column A is Dr. Smith". I have tried and tried to figure out how and where to insert this variable, but I have not figured it out. I am wondering now whether the formula above will even work for this, or if I need to use a DCOUNT/DCOUNTA/COUNTIF/COUNTIFS or something like that.

    Thanks again for any and all help!

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Unique Count Based on Certain Criteria

    It's probably best with these type of formulas not to use entire columns - that will slow the formula down - for data in rows 2 to 1000 you can use this version in F2 copied down assuming you have doctors names in E2 down

    =SUM(IF(FREQUENCY(IF('reference sheet'!C$2:C$1000<>"",IF('reference sheet'!A$2:A$1000=E2,MATCH('reference sheet'!C$2:C$1000,'reference sheet'!C$2:C$1000,0))),ROW('reference sheet'!C$2:C$1000)-ROW('reference sheet'!C$2)+1),1))

    That works for any type of data in column C - if you have numbers in there (not text or alphanumeric) you could try this shorter version:

    =SUM(IF(FREQUENCY(IF('reference sheet'!A$2:A$1000=E2,'reference sheet'!C$2:C$1000),'reference sheet'!C$2:C$1000),1))

    both formulas need to be "array entered"
    Audere est facere

  3. #3
    Registered User
    Join Date
    10-08-2014
    Location
    Birmingham, AL
    MS-Off Ver
    2013
    Posts
    2

    Re: Unique Count Based on Certain Criteria

    Thank you for the info. I put the name of my sheet in place of 'reference sheet', replaced =E2 with ="SMITH, DOCTOR" and did the Ctrl + Shift + Enter. I'm getting an error saying "formula refers to empty cells". Is it ok to do the ="SMITH, DOCTOR" like I did? Because I don't have the doctor's names on my current sheet listed exactly like they are on the reference sheet.

    Also, not to jump ahead, but if I have multiple variables, how/where would I put them in? For example, I also need to add conditions that say if column L = "This" and if column M = "That".


    Thanks so much for the 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. [SOLVED] Count unique entries based off unique criteria in another column
    By hambly in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 06-11-2014, 03:33 PM
  2. [SOLVED] Count unique values in columns based on 2 criteria
    By t83357 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-12-2013, 04:33 PM
  3. [SOLVED] Unique value count based on multiple criteria
    By Ronny66 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-06-2013, 10:18 AM
  4. Count unique values based on several criteria
    By evilgrin in forum Excel General
    Replies: 2
    Last Post: 10-10-2010, 03:50 PM
  5. 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

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