# Counting Different Scenarios in a Dynamic Pivot Table

#### powerpackinduo

##### Board Regular
I have a sheet with the following information:
Column K = Days
Column L = Amount
Column U = Customer (Can be duplicate entries, but will total on pivot table)
Column X = Period (There are on two periods 16 or 17)
Column AM = Area
Column AP = Category (There are only two categories 1 or 2)

The pivot table is laid out as follows:
Page = Area
Column = Period
Row = Category and then Customer
Data = Count of Customer, Sum of Days, Sum of Amount

I need to count a few items in the pivot table but the formulas have to adjust with the “Page” selection of the pivot table.
It can count the pivot table or the data sheet, that does not matter as long as it counts.

Definitions of Counts:
New Customer = Someone that is a period 17 and NOT a period 16
Old Customer = Someone that is a period 16 and NOT a period 17
Return Customer = Someone that is a period 16 AND a period 17

I need to produce totals of the above and then also break it down by their Categories.
Example: There’s a total of 17 New Customers but 7 are Category 1 and 10 are Category 2.
For Return Customers I need to Count who stayed longer in Period 16 than in 17 (Therefore the value in the Days column on the pivot table is greater in Period 16 than 17.) and then vice-versa for longer stay in Period 17.

Is this clear and is it possible? Any help is greatly appreciated.

### Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

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,168,126
Messages
5,857,522
Members
431,883
Latest member
Hien

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