COUNTIFS WITH DISTINCT COUNT

TODDLL

New Member
Joined
Apr 7, 2018
Messages
27
Office Version
  1. 365
  2. 2010
I am counting patients by a specific clinic with a specific visit type. I am using the COUNTIFS formula. I have discovered that some patients have had their clinic visit on a specific date documented twice, and I do not want to count the duplicate entry. There is a unique visit identifier for each visit. If the patient has the same visit ID more than once, I only want to count it once. I am not sure how to work that into the formula. In the image below, if I am counting CLINIC B that had a TYPE C visit, the count would come up as 3, when really there was only 2.

NAMEDATECLINICVISIT TYPEVISIT ID
PT A
7/12/2020​
CLINIC BTYPE C
123456​
PT A
7/12/2020​
CLINIC BTYPE C
123456​
PT B
7/12/2020​
CLINIC FTYPE G
23412​
PT C
7/14/2020​
CLINIC CTYPE W
45623​
PT F
7/20/2020​
CLINIC BTYPE C
895432​
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
What version of Excel are you using? There are different functions available depending on your version. If you update your profile, it would help. Here's one way:

Book1
ABCDEFGHI
1NAMEDATECLINICVISIT TYPEVISIT IDClinicTypeCount
2PT A7/12/2020CLINIC BTYPE C123456Clinic BType C2
3PT A7/12/2020CLINIC BTYPE C123456
4PT B7/12/2020CLINIC FTYPE G23412
5PT C7/14/2020CLINIC CTYPE W45623
6PT F7/20/2020CLINIC BTYPE C895432
Sheet2
Cell Formulas
RangeFormula
I2I2=SUM(SIGN(FREQUENCY(IF(C2:C6=G2,IF(D2:D6=H2,E2:E6)),E2:E6)))
Press CTRL+SHIFT+ENTER to enter array formulas.


This assumes that the Visit ID is an actual number. If you have the latest Excel 365, there's an easier way.
 
Upvote 0
Amazing! I have no formal Excel training and have just learned along the way. I thought I was getting smarter, but guess not. This is above my skill level, but it works!! Thank you so much. Our organization is still on Office 2010 but is slowly migrating over to the cloud. I did update my profile. Thanks for the kind reminder, and thank you so much for your help. This is a great place to get help from experts.
 
Upvote 0
Oh, we're all still learning! When I first saw that formula (on a post in this forum), I had no idea what it was doing either! But I learned from the experts back then, and I'm just passing it along. Glad I could help. :cool:
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,978
Latest member
rrauni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top