+ Reply to Thread
Results 1 to 3 of 3

Calculated Fields in a Pivot Table when 'Fields' appear over Muliple Lines

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Calculated Fields in a Pivot Table when 'Fields' appear over Muliple Lines

    I have a Pivot Table where the 'Fields' appear over multiple lines, e.g. M1 Estimated Spend £000s appears as

    M1
    Estimated
    Spend
    £000s

    I want to add some 'calculated fields' to give me specific totals and every thing I've tried to date just gives be an unhelpful message telling me there is an error in the formula. Basically if I wanted to say total the first three months estimated spend (see sample attached), I'd assumed this would work, but it doesn't

    Please Login or Register  to view this content.
    Note: There is a space both before M1, M2, M3 etc., and at the end of each line before the CHAR(10) line return apart from the last line where there is no space after £000s.

    Is it me doing something wrong or is it simply not possible to achieve this when using line breaks in the field names?
    Attached Files Attached Files
    Last edited by HangMan; 10-14-2015 at 11:02 AM.
    Thanks,
    HangMan

    You can say "Thank you!" by clicking Add Reputation below the post.
    Please, mark your thread [SOLVED] if you are happy with the solution.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,075

    Re: Calculated Fields in a Pivot Table when 'Fields' appear over Muliple Lines

    I think the filename for your attachment may be too long. When I try to download it Windows tells me it can't find the file.
    Trish in Oz
    -------------
    A problem well defined is a puzzle half solved


    If you attach a sample of your workbook it will be easier to find a solution. Remember to remove/replace sensitive data before uploading the file. Look here if you need help with attachments:
    http://www.excelforum.com/faq.php?fa...b3_attachments

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Calculated Fields in a Pivot Table when 'Fields' appear over Muliple Lines

    Hi HangMan,

    As I've understood , you want to create sum of 3 following mounts (as stated in your formula M1, M2, M3), and to get the data from the pivot table.
    To recreate the text "M1 Estimated Spend £000s", use the below formula.

    = "M1" & " " & CHAR(10) & "Estimated" & " "& CHAR(10) & "Spend"& " " & CHAR(10) & "£000s"
    Before CHAR(10) you have empty space.
    Also, the text you need to have it in quotation marks.


    To get value from pivot table, you need to use the "GETPIVOTDATA" function.


    If you want to extract the total sum for the 3 month, use below formula:
    =GETPIVOTDATA("M1" & " " & CHAR(10) & "Estimated" & " "& CHAR(10) & "Spend"& " " & CHAR(10) & "£000s",$B$3) + GETPIVOTDATA("M2" & " " & CHAR(10) & "Estimated" & " "& CHAR(10) & "Spend"& " " & CHAR(10) & "£000s",$B$3) + GETPIVOTDATA("M3" & " " & CHAR(10) & "Estimated" & " "& CHAR(10) & "Spend"& " " & CHAR(10) & "£000s",$B$3)

    If you want to get the sum for particular area (e.g.: East), use the below formula:
    =GETPIVOTDATA("M1" & " " & CHAR(10) & "Estimated" & " "& CHAR(10) & "Spend"& " " & CHAR(10) & "£000s",Pivot!$B$3,"Area","East") + GETPIVOTDATA("M2" & " " & CHAR(10) & "Estimated" & " "& CHAR(10) & "Spend"& " " & CHAR(10) & "£000s",Pivot!$B$3,"Area","East") + GETPIVOTDATA("M3" & " " & CHAR(10) & "Estimated" & " "& CHAR(10) & "Spend"& " " & CHAR(10) & "£000s",Pivot!$B$3,"Area","East")

+ 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. Calculated fields in a pivot table
    By cmarston1500 in forum Excel Charting & Pivots
    Replies: 14
    Last Post: 06-12-2013, 12:24 PM
  2. Pivot Table Calculated fields help
    By james.halliwell in forum Excel General
    Replies: 1
    Last Post: 11-07-2009, 03:12 AM
  3. calculated fields in pivot table
    By minkus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2008, 12:15 AM
  4. pivot Table -Calculated fields
    By sach0025 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2007, 11:38 AM
  5. calculated new fields in pivot table
    By barkarlo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-29-2007, 07:32 AM
  6. Pivot Table with Calculated Fields
    By Florence in forum Excel General
    Replies: 3
    Last Post: 01-20-2006, 10:00 AM
  7. [SOLVED] Sum of Calculated fields in Pivot Table
    By Graham in forum Excel General
    Replies: 0
    Last Post: 07-04-2005, 11:05 AM
  8. Pivot Table: Calculated Fields
    By Natalie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2005, 09:06 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