+ Reply to Thread
Results 1 to 18 of 18

Applying filter to original data from pivot table

  1. #1
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Applying filter to original data from pivot table

    Hello all! Instead of Excel creating a new sheet when I double click on the results of a pivot table, is it possible to just filter the results of the original source data's sheet?

    Here is my situation, I have source data that needs to be updated after someone double clicks on the pivot table data. They won't be able to update the source data if it just creates a new sheet (since it's a copy).

    I'm running Excel 2003. Thank you in advance!!!

    Wayne

  2. #2
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Applying filter to original data from pivot table

    hi,

    Welcome to the Forum

    Yes, this can be done - I may even have some code somewhere (buried on an old compact disc perhaps?).

    Can you please provide more detail:
    What will be double clicked on (eg Header, specific value, Page/Data/Column field)?
    How do you want the Source sheet filtered?
    Can you please upload a sample file with your layout & some dummy data (+ an example "before & after"?


    I'm off to bed now so hopefully someone else can help out (with the extra detail from you) before I'm back...
    Rob
    Last edited by broro183; 12-02-2009 at 07:25 PM. Reason: censorship? "c.d." without the dots was replaced by asterisks?
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  3. #3
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Applying filter to original data from pivot table

    I felt a bit feeble with my last post so I decided I may be able to point you in the right direction before I hit the hay.

    I found Debra's page with a quick google & it looks very promising (if I understand your request correctly): http://www.contextures.com/xlPivot-F...urce-Data.html
    or maybe the link in http://www.excelforum.com/excel-prog...pivotdata.html

    hth
    Rob

  4. #4
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    Rob, thanks for responding! Attached is an example of what I'm looking for. The Master-Before is the data prior to any filtering.
    The Master-After is how I would like the data to be filtered.
    The Pivot sheet is the pivot table and the example is if I double clicked on the total column for Terry in January (C7).

    I just need to double click on the Total column in the pivot table and for the original Master data to be filtered (and possibly activated) so I can make changes to the original data with the entire row displayed (and no new sheet created), but only have those filtered lines showing.

    Hope that makes sense. If you have any old code, that would be great!!! Just found this forum and it has tons of tips and tricks in it. Thanks!

    Wayne
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Applying filter to original data from pivot table

    hi Wayne,

    Yes, the site is great
    Here's a link list from the members: http://www.excelforum.com/excel-misc...additions.html

    No, you didn't throw me off...
    I found my old code - but my memory was rusty - it doesn't filter the source data it searches & maps "old" inventory numbers against new ones on the copy of data that is created by a doubleclick

    Do any of the code snippets/example files on Debra's site work for you in Excel 2003?
    I'm trying to overcome an "Unable to get the ColumnRange property of the PivotTable class" message when running the code in 2007, but I probably won't get back to it until sometime in the weekend.

    Unless, is your example file the exact layout of your actual workbook?
    If so, I can hardcode some of the info in the macro so it will work in this situation (but won't be flexible).

    Rob

  6. #6
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    Rob, I did find some code to do what I would like here: http://www.contextures.com/xlPivot-F...urce-Data.html

    Unfortunately, I get a 'Subscript Out of Range' error (Run Time Error 9) when I went to go test it out (on their sample file). Do you get the same? I'm running Excel 2003.

    My sample file is not the same format, but I could delete a bunch of source data, headers, etc. and upload. Thx!

  7. #7
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Applying filter to original data from pivot table

    If you could upload a file with your real format we can probably do some jiggling to make the code from Debra's Contextures site work...

    Nope, for me in excel 2007 it errors on the "with .columnrange" (error 1004) but I suspect that will be irrelevant when you upload a new file.

    What line of code is highlighted when it errors with the out of range message for you?

    I'm up early tomorrow so I'm off soon - 'til next time, goodluck!

    Rob

  8. #8
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    This is the line of code it errors out on me with:

    If Application.CountIf(Worksheets(xSht).Range(xRng), xCell) > 0 Then
    I'll have to send up an actual example of the worksheet minus real data. I'll see if I can upload tomorrow. Thx!

  9. #9
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    Rob, example with true field layout for source and pivot table is attached. I would like to click on any of the totals in column H on the pivot table and have it filter the source data on the 'MasterData' sheet. Thanks!!!!

    Wayne
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    08-04-2007
    Location
    London
    MS-Off Ver
    work: 2003, home: 2008 for Mac
    Posts
    32

    Re: Applying filter to original data from pivot table

    I'm working on a spreadsheet that does something similar at the moment, difference is my pivot data needs to be integrated with non-pivot data (i.e. pivot data, manual entry, pivot data, manual entry and so on) so I'm using GETPIVOTDATA extensively to maniupulate the display

    Macro 1: determines the values to filter on

    Marco 2: takes values and filters the data on those values

    I can get this code to you on monday when I'm not on a mac (who on earth decided not to include vba on excel for Mac!?!)

  11. #11
    Registered User
    Join Date
    08-04-2007
    Location
    London
    MS-Off Ver
    work: 2003, home: 2008 for Mac
    Posts
    32

    Re: Applying filter to original data from pivot table

    this is what I'm using for the actual filter bit:

    Please Login or Register  to view this content.
    where row 1 is the header row of your data

  12. #12
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    Zonino, if you could please forward the macros, that would be great! I'm not an Excel coding pro and any help would be appreciated! Thx!

  13. #13
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Applying filter to original data from pivot table

    Fingers crossed that Zonino has the code...
    I'm sorry I haven't responded before now, but I'm having a challenge overcoming the ".columnrange" error so I've stepped away & hopefully when I try the code again - the fix will JUMP out at me!

    Rob

  14. #14
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    Rob, not a problem! I think both solutions would be great! If you can figure out the problem, please share!! Thanks!

  15. #15
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    Rob/Zonino, make any progress on the code or macros?

    Rob, could the error be because of a referenced DLL or library that is not included?

    Zonino, I know what you are trying to do, but can't figure out how to make it dynamic to where it could be double clicked on the total and have it figure out the filter on another sheet.

    Thanks guys! I know I'm hardly a priority.

    Wayne

  16. #16
    Registered User
    Join Date
    12-02-2009
    Location
    Minden, NV
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Applying filter to original data from pivot table

    Figured it out! That scripting sample will not work if it is pulled from a .zip file. You need to save it to hard disk. Also, I made a change to the script to where it will properly filter (blank) pivot fields (otherwise it uses "(blank)" as a filter)...and nothing appears.

  17. #17
    Registered User
    Join Date
    08-04-2007
    Location
    London
    MS-Off Ver
    work: 2003, home: 2008 for Mac
    Posts
    32

    Re: Applying filter to original data from pivot table

    Hi Wayne, sorry I keep coming on the forum when I'm at home on my Mac! will try and remember to post this tomorrow at work

  18. #18
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Applying filter to original data from pivot table

    Quote Originally Posted by Oingofan View Post
    Figured it out! That scripting sample will not work if it is pulled from a .zip file. You need to save it to hard disk. Also, I made a change to the script to where it will properly filter (blank) pivot fields (otherwise it uses "(blank)" as a filter)...and nothing appears.
    Hi Wayne,

    That's great that you've figured it out
    Can you please post your modified code?
    This may let others use it... & it will definitely be of help to me!
    It may just be some further differences in Excel 2003's VBA v Excel 2007's version but I certainly can't get the code to work in Excel 2007 (zipped/unzipped).

    The problem I found in the code when used on your pivot table was that the PT had no "columnrange" (in VBA of 2007) & I haven't been able to resolve it. It's been driving me a little mental but as DO has said something like this would "be pretty complex given the flexibility inherent in PT design" (http://www.excelforum.com/excel-prog...pivotdata.html)

    I look forward to seeing your solution (& Zonino's) & then instead of being frustrated - I can learn!

    Rob

+ 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