# Pivot Tables - Comparing Grand Totals to each other

#### arveearv

##### New Member
Hi:

Imagine a medical clinic where there are, say, 5 doctors who each have their own list of patients. Every once in a while, though, one doctor will pitch in and see the patient of a colleague.

Here is a sample set of data:

Here's a pivot table that summarizes the data:

So far, so good. But now I want to know, for each doctor, how much more (or less) they are contributing than receiving. Doctor2, for instance, has provided a Grand Total of 2 care units to patients that belong to someone else, but Doctor2's patients received 3 units of care from other doctors. So Doctor1's "Grand Total Difference" should be +1.

How can I calculate this, given that the Grand Totals columns will always be in different places, depending on how many doctors are providing care in a clinic?

Thanks!

### Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

#### arveearv

##### New Member
Hi:

I think I may have answered my own question. See if this makes sense. Alas, this is a time when the "Sumif" function trumps the Pivot Table!

Instead of using the Pivot Table data, I used the raw data (shown in the Top graphic, above). For each doctor, I created a new cell called "Balance". Here's the formula for "Doctor3":
=SUMIF(B:B,"Doctor3",D:D)-SUMIF(C:C,"Doctor3",D:D)

It works, but I think the Pivot Table met its match with this one.

Last edited:

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,668
Messages
5,838,680
Members
430,563
Latest member
Raeyven

### 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.

### Which adblocker are you using?

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

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