+ Reply to Thread
Results 1 to 11 of 11

Dynamic Pivot Table Probems

Hybrid View

  1. #1
    Registered User
    Join Date
    05-27-2008
    Posts
    25

    Dynamic Pivot Table Probems

    Here goes - this might take some explaining:-

    I have a spreadsheet the includes data validation, auto fill fields using formulas and conditional formatting all over the place. The user will be adding rows of data whenever applicable, so I want to create a dynamic pivot table that will update automatically. I think I've done it properly, Insert - Name - Define. In the Refers To field, I've added:-

    =OFFSET(Sheet1!$A$10,0,0,COUNTA(Sheet1!$A:$A),12)

    I've then based the Pivot Table on the defined name. For some reason, when I add a new row of data, the pivot table doesn't update, I have to do it manually. When I go back into Sheet1 and click in the Refers To field, there is an extra "blank" row showing as included in the data range (screen print attached) Is my OFFSET wrong, or does it have anything to do with the fact each row (down to line 300) contains formulas and #N/A's? I've used this before and can't see what I'm doing differently, other than the aforementioned formulas etc.

    Any help/advise appreciated
    Attached Files Attached Files

  2. #2
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129
    Is there anything in any cell in A1:A9? Or A20:A65000?
    Oldman Chatting: [email protected] Mailing: [email protected]

  3. #3
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    Yes, A1:A9 has various headers/titles, not related to any of the calcs I'm trying to do, they're just cosmetic. Not sure how to word this, but A20:A300 are all linked to a data validation list, which is the same for columns D, G, H, I & L. Columns B, C & J all contain formulas - B & C are linked to whatever the user selects in A, and J is calculated based on the selection in column I. In all cases, the formulas/validation goes to Row 300. There's nothing in any of the other rows.

  4. #4
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129
    I think you may try
    =OFFSET(Sheet1!$A$10,0,0,COUNTA(Sheet1!$A$10:$A$300),12) instead
    Last edited by ptm0412; 08-29-2008 at 09:27 PM.

  5. #5
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    No joy I'm afraid, I still need to refresh the pivot table. Thanks for the suggestion though.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    How can anyone see the problem when you don't attach a example file to see what your doing wrong.

    Why post a word document to a excel forum ??

    PS. I suspect your sheet name isn't sheet1

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  7. #7
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    The reason for the word document is because I wanted to show a screenshot and that was the easiest way I could find. The actual workbook contains confidential data which I can't post on a public forum, but I've removed it and attached a "blank" copy.

    PS - the sheet is called Sheet1.
    Attached Files Attached Files

  8. #8
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129
    Yes, the Pivot Table cannot be autorefreshed, we have to click refresh button, even if you simply change the available data (for instance, change an amount from 400 to 420).

    Anyway, your PivData name is refered to an absolute column but row relative reference:
    =OFFSET(Sheet1!$A$10;0;0;COUNTA(Sheet1!$A10:$A300);12)
    So it changes according to your current selective cells. It must be all absolute (row, column) like $A$10:$A$300

    And, you still must press the refresh button. The different is it refreshes to the exact datasource.

    However, you could make a macro like this to force the PivotTable to be refreshed any time you change or add data in column A or column F (Amount):

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
    If 
    Target.Column Or Target.Column 6 Then
    ActiveSheet
    .PivotTables("PivotTable1").PivotCache.Refresh
    End 
    If
    End Sub 
    Last edited by ptm0412; 08-30-2008 at 12:35 PM.

  9. #9
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129
    I think last time you used CountA($A:$A) and it worked, because you didn't have tittle. Now you have a tittle in A5, then CountA return a number of 1 unit larger, lead to adding 1 blank row below your source data. You can use CountA($A:$A)-1 also.

    But when you are standing on cell A10 and define the name with relative reference like CountA($A10:$A300), then it will change. For example, if you now stand on cell any cell in row 9, your Name will refered to $A9:$A299. If you stand on cell A11 or B11, it will refered to $A11:$A301.

    So, as I have said, you should defind name to a full absolute reference $A$10:$A$300

+ 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. Pivot Table - Few complicated queries
    By acsishere in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-04-2008, 05:08 PM
  2. Creating pivot table to Existing worksheet
    By Malvaro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2008, 09:30 AM
  3. To formulate a table based off a single row of Pivot data
    By money n da sank in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-31-2008, 11:28 AM
  4. Dynamic Range for Pivot Table
    By Buffy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2008, 12:59 PM
  5. a pivot table report cannot overlap another pivot table report
    By judyh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-25-2007, 12:59 AM

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