+ Reply to Thread
Results 1 to 4 of 4

change pivot data source automatic

  1. #1
    Registered User
    Join Date
    03-10-2005
    MS-Off Ver
    Excel 2013
    Posts
    95

    change pivot data source automatic

    hi,

    need to ask if we can make like macro to change the pivot data source as our input.

    let say in A1 we type :"data source" and in B1 is blank cell..

    whatever sheet name we type in B1 then press a Button..then pivot table will refer to that B1 name (we could use white color in that area to make it invisible)

    thanks
    Last edited by koi; 09-20-2012 at 07:24 AM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: change pivot data source

    Hi Koi,

    See the attached workbook... where I have given defined names to two data tables. These names are available for you to select in cell B1 as in data validation drop down. Now I have used Indirect function to catch this name as a source to pivot table. Now.. when you change the name in cell B1, just refresh the pivot table.. and data source will be changed
    pivot data source referenced through a cell.xlsx

    Hope this helps you to start on.. thanks.

    regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    03-10-2005
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: change pivot data source

    hi dilipandey,

    thanks for the help..and the example is good enough since my pivot table will get same column and everything only the location is different.

    if we put aa in sheet2, bb in sheet3, cc in sheet 4 and so on..can it still be done?

    can you explain the logic here? i seen in name manager there are 3 formula there, 2 for identifying the location of source.. and 1 is using as indirect in B1, is that all the 3 formula needed?

    i just need to create pivot table from aa or bb..then later when i change in B1, then press refresh, the pivot table is refresing?

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: change pivot data source

    Hi Koi,

    Defined names can work here as they can be scoped to entire workbook... In name manager, yes, there are 3 formulas.. and you are correct in your understanding as on that stage.. but since you are going to use the aa,bb,cc in different sheets, you may need to enhance the Indirect formula to accommodate these changes. I would suggest you to learn about Indirect function and I 'm sure you can do it.

    You need to create a pivot table with a source name which you would define using indirect function (which would have already referring to the aa,bb,cc as they were there in Cell B1 in our earlier example). Now when a master name (using indirect function) is defined and ready, you just need to change the aa,bb,cc etc and then just refresh pivot. thanks.


    Regards,
    DILIPandey

    <click on below 'star' if this helps>

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1