+ Reply to Thread
Results 1 to 9 of 9

Getpivotdata formula cell referencing

  1. #1
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Getpivotdata formula cell referencing

    Hi,

    How come doing this doesnt work?

    =GETPIVOTDATA("Payment",PivotTables!$B$25,"Year",Formulas!J4)

    I want to have the item at the end link to a cell reference so it can change.

    Any idea on how to make that work?

    Thanks.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Getpivotdata formula cell referencing

    Attach a sample file so we can make it work for you. I have used similar functions often and they work fine.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Getpivotdata formula cell referencing

    Theres a lot of data and it'll take quite a while to remove the sensitive parts.

    The formula works fine when the reference at the end is replaced with the text e.g. "2014", but it gets a #REF error when theres a cell reference

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Getpivotdata formula cell referencing

    Should work, as long as Formulas!J4 contains a value which matches the values in your Year field. #REF error suggests the two data types / values don't match.

    How is your Year field formatted (numberformat) and does that match Formulas!J4 ?

    Try attaching a workbook so we can see what the problem is.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  5. #5
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Getpivotdata formula cell referencing

    Quote Originally Posted by OllyXLS View Post
    Should work, as long as Formulas!J4 contains a value which matches the values in your Year field. #REF error suggests the two data types / values don't match.

    How is your Year field formatted (numberformat) and does that match Formulas!J4 ?

    Try attaching a workbook so we can see what the problem is.
    I have attached a sample workbook outlining the error.

    Hopefully you can see where I am going wrong.
    Attached Files Attached Files

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Getpivotdata formula cell referencing

    As suspected, it's a numberformat issue. The data feeding your pivot table has years formatted as text, the cell you reference containing the desired year is formatted as a number.

    Easy fix - change your getpivot formula to:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    OR change the year cell to:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    OR change your source data to store years as numbers, not text - e.g. in cell C4 of your example:

    Formula: copy to clipboard
    Please Login or Register  to view this content.



  7. #7
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Getpivotdata formula cell referencing

    Quote Originally Posted by OllyXLS View Post
    As suspected, it's a numberformat issue. The data feeding your pivot table has years formatted as text, the cell you reference containing the desired year is formatted as a number.

    Easy fix - change your getpivot formula to:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    OR change the year cell to:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    OR change your source data to store years as numbers, not text - e.g. in cell C4 of your example:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Ah wicked!

    Thanks for the fast reply and the clarification on this.

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Getpivotdata formula cell referencing

    You may also use simply:

    =GETPIVOTDATA("Payment",$A$16,"Year",""&year!B3)

    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  9. #9
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Getpivotdata formula cell referencing

    FORUM MODERATOR'S REQUEST:

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as "SOLVED".
    For the meantime I'll do it for you.

    How?
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Note:
    You can also thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given.
    By doing so you can add to the reputation(s) of those who helped and shared their time in helping you.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

+ 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. [SOLVED] Formula referencing to a cell with same name as a Tab
    By mjfox52610 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2013, 05:13 AM
  2. GetPivotData referencing another (changing) workbook
    By Excel432 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-15-2012, 12:15 PM
  3. Replies: 1
    Last Post: 10-14-2012, 12:23 AM
  4. Change Cell Font Color if Cell Contains Formula Referencing Another Cell
    By wilcox.patrick in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2012, 10:24 PM
  5. GETPIVOTDATA referencing
    By EMD in forum Excel General
    Replies: 3
    Last Post: 07-12-2007, 12:40 PM

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