+ Reply to Thread
Results 1 to 6 of 6

Auto update of fields in Pivot table

  1. #1
    Forum Contributor aganesan99's Avatar
    Join Date
    04-26-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    129

    Post Auto update of fields in Pivot table

    Hello,

    I have a pivot table which shows the previous year current month (Nov'17), the Dec'17, the current month (Nov'18) values for comparison. We need to change both the previous year current month and the current month every month. I have around 15 files with 10 pivot tables in each file to be updated.

    In the Pivot table source data, the column containing the previous year current month (Nov'17) gets changed every month. (refer sample file attached)

    Can someone help on this by using macro.

    Thanks in advance

    Regards,
    aganesan99
    Attached Files Attached Files
    Last edited by aganesan99; 11-28-2018 at 12:34 PM. Reason: Included attachment

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: Auto update of fields in Pivot table

    Istead of a macro, try a column of formulas in your source data that return TRUE for the data of interest, and FALSE for everthing else, based on the date associated with the data point, along the lines of

    =OR(AND(MONTH(A2)=MONTH(TODAY()),YEAR(A2)=YEAR(TODAY())),AND(MONTH(A2)=MONTH(EDATE(TODAY(),-12)),YEAR(A2)=YEAR(EDATE(TODAY(),-12))),AND(MONTH(A2)=MONTH(EDATE(TODAY(),-11)),YEAR(A2)=YEAR(EDATE(TODAY(),-11))))

    (For dates in column A, of course...)

    Then use that field as a page filter, and when you refresh the data after a month change, the correct data will be extracted.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor aganesan99's Avatar
    Join Date
    04-26-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    129

    Re: Auto update of fields in Pivot table

    Thanks for the reply Bernie.

    I tried your formula in my data and could not include that in the pivot table. Attached the file for your reference (tab "DATA (2)".

    Please help.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: Auto update of fields in Pivot table

    Your table is not a database, so you need to unpivot your cross-tab table using a data query. It is very simple to do - if you haven't used Data Queries before it is worth learning.

    After you unpivot your current table, then you can apply the logic formula to every row of the new table in a new column, and that will allow you to then use a pivot table with filters to show the desired data.

  5. #5
    Forum Contributor aganesan99's Avatar
    Join Date
    04-26-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    129

    Re: Auto update of fields in Pivot table

    Thanks Bernie.

    Will try googling about Data queries. Could you suggest some links for Data queries.

    Regards,
    aganesan99

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: Auto update of fields in Pivot table

    Here is something to get you going on un-pivoting:

    https://www.myexcelonline.com/blog/u...l-power-query/

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto Update a Pivot Table each Month
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2015, 01:43 PM
  2. Replies: 7
    Last Post: 01-09-2014, 01:16 PM
  3. Pivot table auto update
    By alleyb in forum Excel General
    Replies: 11
    Last Post: 01-28-2012, 01:45 AM
  4. Excel 2007 : Pivot Table Auto Update
    By OrangeBoy in forum Excel General
    Replies: 0
    Last Post: 10-13-2011, 10:20 PM
  5. PIVOT TABLE: Data fields don't update
    By olga6542 in forum Excel General
    Replies: 2
    Last Post: 06-17-2011, 02:56 PM
  6. Update Pivot table fields with variables
    By joneswesley in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2009, 05:07 AM
  7. Auto Update Range of a Pivot Table
    By TJDeborah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-19-2006, 08:35 AM

Tags for this Thread

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