How to reference cells in a pivot table when the table layout changes each month

tfoster

New Member
Joined
Mar 29, 2007
Messages
5
I'm building monthly reports from one or more pivot tables (Excel 2003). My pivot tables have 3 initial columns: Trade Sector, Category, Brand (and then a load of data in columns to the right). The Trade Sectors obviously only appear once in the 1st column, but the Categories and Brands are repeated down the Pivot Table (e.g. all 10 Categories get repeated for each Trade Sector).
I'm building some neatly formatted tables that reference the pivot tables. The problem is that the number of rows in the pivot table might change each month as new data is fed into the pivot table (from a dynamic named range feeding off a big data dump that is automatically refreshed each month).
So I can't reference say cell $C$350 each month and expect it to be the first named brand in the third category, as the categories above may have expanded or contracted.
I can't use the GETPIVOTDATA command, as my brands are ranked from largest to smallest in each category so BrandA might be the biggest brand in the category that month, but it may be replaced by BrandC the next month.
What I need, as an example, is a way to be able to get Excel to look down column A and find TradeSector2 (which I can specify), then look down column B and find Category 4 (which again I can specify), and then return the 1st, 2nd, 3rd brands etc (which I can't specify) from column C for that category/trade sector combination.
Any ideas? I've tried both GETPIVOTDATA and INDEX/MATCH formulas, but can't find a practical solution.
Thanks for any help,
Tim.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
These formulas should return the names of the first 3 brands under Category 4 for TradeSector2:

=INDEX(INDEX(C:C,MATCH("TradeSector2",A:A,FALSE)):C100,MATCH("Category 4",INDEX(B:B,MATCH("TradeSector2",A:A,FALSE)):B100,FALSE))

=INDEX(INDEX(C:C,MATCH("TradeSector2",A:A,FALSE)):C100,MATCH("Category 4",INDEX(B:B,MATCH("TradeSector2",A:A,FALSE)):B100,FALSE)+1)

=INDEX(INDEX(C:C,MATCH("TradeSector2",A:A,FALSE)):C100,MATCH("Category 4",INDEX(B:B,MATCH("TradeSector2",A:A,FALSE)):B100,FALSE)+2)
 
Upvote 0
These formulas should return the names of the first 3 brands under Category 4 for TradeSector2:

=INDEX(INDEX(C:C,MATCH("TradeSector2",A:A,FALSE)):C100,MATCH("Category 4",INDEX(B:B,MATCH("TradeSector2",A:A,FALSE)):B100,FALSE))

=INDEX(INDEX(C:C,MATCH("TradeSector2",A:A,FALSE)):C100,MATCH("Category 4",INDEX(B:B,MATCH("TradeSector2",A:A,FALSE)):B100,FALSE)+1)

=INDEX(INDEX(C:C,MATCH("TradeSector2",A:A,FALSE)):C100,MATCH("Category 4",INDEX(B:B,MATCH("TradeSector2",A:A,FALSE)):B100,FALSE)+2)
Hi Andrew,

Thanks for your quick reply. I am currently adapting your formula to fit the specifics of my spreadsheet.
Whilst it does work, I'm unsure as to the role of ":C100" and ":B100" in the formula. I can't see why these cells are being referenced. Can you just explain that bit?
Thanks,
Tim.
 
Upvote 0
Whilst it does work, I'm unsure as to the role of ":C100" and ":B100" in the formula. I can't see why these cells are being referenced. Can you just explain that bit?

I just used those as an example. Adjust them so that they include the bottom row of your pivot table if necessary.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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