Change source worksheet for pivot based on cell value

Obeide

New Member
Joined
Dec 20, 2012
Messages
9
Hi,

I need to change the source for a pivot table based on the value in a cell. I have a worksheet named 'Summary' with a cell (A1) that has a dropdown containing the choices of Option1 and Option2 which refer to worksheets named 'Option1' and 'Option2' (this changes dynamically and there may be more than two options). Each Option worksheet has a table with exactly the same range (C56:L251) and I want the pivot table on the Summary worksheet to update depending on whether Option1 or Option2 is chosen as the source in cell A1.

I have tried unsuccessfully using a named range
Code:
=INDIRECT("'"&'Summary'!A1&"'!C56:C251")


Any and all help gratefully received.
Excel 2007
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi thanks for your suggestion, I have tried it and I get the error 'Reference is not valid'. Can you please suggest something else I might be able to try?
 
Upvote 0
Hi thanks for your suggestion, I have tried it and I get the error 'Reference is not valid'. Can you please suggest something else I might be able to try?
It should work. Try again ensuring:

  • There are dollar signs around the A1 - i.e. $A$1
  • You are using the named range as your reference rather than the actual formula
  • The named range formula has been entered correctly - no extra quote marks have shown up
If it still doesn't work, perhaps paste a link to your file on Dropbox or Skydrive and I can have a look.

I don't think it is a good idea to do this though, as the user still needs to refresh the PivotTable each time unless you add some VBA code to hande that for example. It would be easier to just have seperate sheets with the different PivotTables and links to them on the Summary sheet.
 
Upvote 0
Hi, thanks for your help with this, i finally figured out that the issue was that I had a blank space after the sheet name, so it couldn't find it!.
 
Upvote 0

Forum statistics

Threads
1,216,105
Messages
6,128,859
Members
449,472
Latest member
ebc9

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