Pivot Table - Calculated Field - Counting Distinct Values For with If Condition Met - Excel 2013

Propelissa

New Member
Joined
Apr 27, 2015
Messages
1
How can I create a calculated field in a pivot table that will count distinct values of Field1, given that Field2 meets a particular condition?


My limitations:


  • Needs to be in a pivot table
  • Needs to be a calculated field
  • The calculated field needs to be a unique count "formula", not simply a field setting change

Here is an example of what I am trying to achieve.


Raw data (I couldn't get the copy and paste formatting to work):


═════════════╦═══════════╦═════════╗
║ Date Period ║ Client ID ║ Field 2 ║
╠═════════════╬═══════════╬═════════╣
║ 1 ║ A ║ 1 ║
║ 1 ║ A ║ 1 ║
║ 1 ║ A ║ 1 ║
║ 1 ║ B ║ 1 ║
║ 1 ║ B ║ 1 ║
║ 1 ║ C ║ 1 ║
║ 2 ║ A ║ 1 ║
║ 2 ║ A ║ 1 ║
║ 2 ║ B ║ 0 ║
║ 2 ║ C ║ 0 ║
║ 2 ║ C ║ 0 ║
╚═════════════╩═══════════╩═════════╝





Here is what the Pivot Table output would look like:



<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">╔═════════════╦═══════════════════════════════════╦═══════════════════════════════════╗
║ Date Period ║ Distinct Clients where Field 2= 1 ║ Distinct Clients where Field 2= 0 ║
╠═════════════╬═══════════════════════════════════╬═══════════════════════════════════╣
║ 1 ║ 3 ║ 0 ║
║ 2 ║ 1 ║ 2 ║
╚═════════════╩═══════════════════════════════════╩═══════════════════════════════════╝



</code>
I have seen methods of using array functions (a combo of SUM, IF, FREQUENCY, and MATCH) for non-pivot table data. Can I do this with Pivot table fields?


I don't have any VBA background.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

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