How to Consolidate Rows in Excel Without Compromising Original Data

microsoft excelmicrosoft-excel-2010

I work in medical billing and need to consolidate patient names to run reports for my supervisor. Here's the issue:

I receive a detailed report from an outside agency that lists all pharmacies, physicians, patients, and clinics for the previous month. The latest report had over 12,000 rows. Every row represents a medication that was prescribed to a patient. So multiple rows might have information on the same patient. To demonstrate I created the following example:

Example Table
So John Doe has two records because he has been prescribed two different types of medication. I want to create a report that tells me how many individual patients I have at a particular clinic location. I can create a pivot table that tells me the "count" but as it does not take into account that someone with the same first name, last name, and birthdate are a single individual – my result is way off. I am hoping there is a way for me to consolidate all the entries for a single patient into one group, so individuals are not double or triple counted.

Best Answer

This is what I would do in your situation:

  1. Convert the data you have received into a table.
  2. add a 'Name' column to the right of the data; use concat to achieve this
  3. add a 'Name + DOB' column to the right of that to get uniqueness; again use concat

Table

  1. Use the 'Summarise with PivotTable' function in the Table ribbon
  2. Make sure that you check the box at the base of the PivotTable option that says 'Add this data to the Data Model'

DataModel

  1. Drag 'Clinic location', 'Patient DOB', and 'Name' into the 'Rows' portion of the PivotTable fields.
  2. Drag 'Name and DOB' into the 'Sum Values' portion of the PivotTable fields. Make sure it says 'Count'
  3. Repeat step 7. Drag 'Name and DOB' into the 'Sum Values' portion of the PivotTable fields. Click on the entry and choose 'Value field settings'. In the 'Summarize value field by' list, scroll to the bottom and choose 'Distinct Count'

DistinctCount

Play with the pivot table until you get what you want. Pivot Table

Related Question