# Excel 2007 :: Calculated Field To Get Percentage Of Two Columns In Pivot Table

Oct 2, 2013

I'm having an issue getting the correct results from a calculated field in a pivot table in Excel 2007.

In column A I have "Business Name", in B I have a sum of the amount of lines a customer has, and C is a MAX of the number of employees the customer has at their location.

In one example I have a business with sum 50 lines and max 30 employees but when I try to make the calculated field 50/30 (should equal 166%) i get 9.2% instead.

The reason appears to be because there are 18 types of lines the customer has and 18 x max 30 = 540 and 50/540 is 9.2%. In the attached example it's all the same business location so the total number of employees (30) is the same for each row and each row in the raw data is a set of lines with similar features.

I attached an example. CalcFieldProblem.xlsx

## Excel 2007 :: Pivot Table Calculated Field

Mar 19, 2009

I believe that I am finally getting the hang of pivot tables and VBA ... pretty nice. Now for my latest frustration - calculated fields.

I have a pivot table created which compares two years of data. The problem seems to be that this data is from the same data field (PINSAL) even though it shows in two columns (year 2007 and year 2008).

1 - I need to subtract the 2007 figure (column C) from the 2008 figure (column D) in a calculated field called DollarVariance

2 - I need to divide DollarVariance into the 2007 figure to create a calculated field called PercentVariance

This seems easy to do if I had two different variables used to create the 2007 and the 2008 data but it is the same datafield. Can I use column letter? Can I use the column name assigned by the pivot routine (12 - 2007 and 12 - 2008)?

## Excel 2007 :: Pivot Table Calculated Field With Reference

Nov 18, 2012

I have a set of sales data and need to create a run rate which is simply = Total Sales/Selling Day

Selling day changes most days.

I put the calculation into my pivot data but it's summing up, (instead on 12 I get 720) so I changed this to Average so I get the right figure in the Pivot but when I then use this field, it doesn't use the Average amount, it uses the summed figure.

So what I need is Total Sales/X

X = Cell Reference

## Pivot Table Calculated Field Based On 2 Columns?

Jun 9, 2014

I have a Table with 2 columns "Due Date" and "Completed Date". The pivot table from the table gives the count of each column. I want to have a calculated column giving the % complete, ie. "Count of Completed"/"Completed Date"*100. When I attempt to create this formula (using Pivot Table Options > Fields Items and Sets > Calculated field), I get a DivZero error, even though both columns are not zero. How do I create such a calculated column?

## Excel 2007 :: Sorting Pivot Table Columns By Column Field Label (date)

Jun 30, 2014

I have a pivot table with multiple row fields and multiple column fields. One of the column fields is a Date and I need some VBA that will auto-sort the columns into ascending order by the Date column field.

E.g., if the first four column labels are "2-Jun-2010, 13-May-2009, 16-May-2013, 17-May-2012" then i want the sort to arrange them as "13-May-2009, 2-Jun-2010, 17-May-2012, 16-May-2013".

Note: This is the left to right order of the columns i'm talking about, not the top to bottom order of the rows, or the data in the rows but specifically the column labels.

I've tried googling a solution and I can find a variety of code that deals with sorting the data in the rows in all sorts of ways, but nothing on how to order the columns.

i'm using excel 07, and the source data for the pivot table has the Date field formatted as custom "dd-mmm-yyyy". This can be changed if necessary.

## Excel 2010 :: Pivot Table Add Calculated Field Based On Certain Text In Report Filter

May 29, 2014

Any way to create a calculated field in an Excel 2010 pivot table that will find all the Transaction Types (Report Filter) with "transportation" in them and make the field Quantity 0 and leave all other quantities the same? I do not want the quantity of transportation added in twice and may not have the flexibility of adding a column to the raw data.

I used the formula below in a calculated field and it does not match the values using the added column to the data file.

=IF(ISERROR(SEARCH("*transportation*",'Transaction Type')),Quantity, 0)

I am trying to get the sum of Quantity field to equal the AdjQuantity field using a calculated Pivot field and not add a new column to the data.

## Excel 2007 :: Add Calculated Members In Pivot Table From SSAS OLAP Cube

Nov 4, 2012

I use Excel to query a SSAS OLAP Cube, the return of which I then model into various outputs. I do not have access to amend the cube.

I am hoping it is possible to be able to add custom calculated members to some dimensions in excel rather than on the server, but I'm struggling to find any resources that explains how it is done or if it is even possible. For example, the cube will return the dimension 'Source Country' with members 'England', 'Northern Ireland', 'Scotland', 'Wales', I would like to add a calculated member 'United Kingdom' to consolidate all those members.

Is this possible or should I just look to calculate this consolidation by formulas in the model.

Excel 2007
Win7 Pro

## Calculated Field In Pivot Table?

Jan 21, 2014

Can I add a calculated field formulas in Excel pivot table. Such as CONCATENATE?

## Pivot Table Calculated Field

Mar 26, 2014

Ihave a pivot table that takes data from a table, groups the duplicate items and adds their values up - so it shows just one entry for each item. I now want to add a calculated field in there so that I can divide one of the fields into another.

## Pivot Table Calculated Field?

Jun 19, 2012

I have a pivot table with 2 row filters (dept and name) and then three columns - Year 1, Year 2. I need to add a calculated field inbetween Year 1 and 2 to show the variance in dollars from ( Year1-Year2) as well as an additonal a column that shows the percentage change between the tw o years . I know I can copy this over and add formuals in Excel but I need to retain the features of the pivot tables due to the 2 row filters?

## Excel 2007 :: Pivot Table - How To Display And Use A Field

Jan 26, 2012

I have a table of data which I am analysing in a Pivot Table. For the majority of the data, the Pivot works very well: however I have a small issue, but it subsequently means the Pivot is useless.

Within the table array that I am referring to, there is a column of data of "Days per employee for a given period". The rows of data within the table array relate to every absence entry per employee, but this final column of data always contains the same figure (although can differ from employee to employee).

When I put the data into the Pivot, I can summarise the absence(s) as a simple sum. However, this final column of data should not be summed, since it is already the sum figure.

This figure though needs to be part of the Pivot, since I need to report on the percentage of absence days per type over the given period. So, the simple representation of =absence day(s)/worked days does not work... well I cannot get it to work. Additionally I have tried features like % of, but nothing.

I am using excel 2007.

## Pivot Table - Calculated Field / Item?

Mar 18, 2014

I have a data that consists of months, forecast and actual.

I've created a pivot table where; months is on the row, forecast and actual is on the values

I wanted to know the percentages between forecast and actual (forecast / actual) to see how it perform each month.

How do I go about inserting a pre-defined named called "percentages" on pivot table with calculated field or calculated item on pivot table itself?

## Pivot Table - Add Calculated Field Not Working

Apr 26, 2012

I have and excel sheet that pulls data from an external source (ServiceNow) via MS Query.

From the exported data, I have the following:

Date opened (MM/DD/YYYY HH:MM:SS AM/PM)
Date closed (MM/DD/YYYY HH:MM:SS AM/PM)
calendar_stc (this exports in seconds, such as 136) (this equals date closed minus date opened for each record)
assignment group

From this export, I'm trying to make a pivot table to show the average calendar_stc per assignment group, per month, per year; but in hours, not seconds.

I thought this was an easy process, create pivot to group row data by years then by months. Then add in assignment group to to the Rows as well. From there, I added to the values section of the pivot the calendar_stc. The default, of course, is to sum each row. But I need the average so I switched it to average. Now it is showing the correct average calendar_stc in seconds per group. To make it hours, I figured I could add in a calculated field. To do that I added the formula of =calendar_stc/60/60 for the calculated field. When I hit okay, it's giving me the SUM in hours for each row. Modifying the field settings to average does not change the numbers. So I went back into the formula and modified =average(calendar_stc/60/60). And that is not working either.

Here is an example to show the math with my formula.

## Removing Calculated Field From Pivot Table Using VBA

Feb 5, 2014

I am trying to create a dynamic pivote table that can be update using a value in a cell. I can get everything updating and working correctly except I am unable to remove the one calculated feild from my pivot table. I am able to remove all other fields without problem. Code below: (lines 13 and 14 is the code that i cant get to work)

Private Sub CommandButton1_Click()
Dim dt As String
Dim dt2 As String
On Error Resume Next
dt = Sheets("Executive Summery").Range("M1")
dt2 = dt & "2"

[Code]....

## Pivot Table Calculated Field With Count

Jun 26, 2014

I am trying to calculate a ratio for Hours per Ticket by month. I have a pivot table that COUNTS tickets and SUMS hours per month. I was hoping to create a calculated field to the jist of COUNT(Tickets) / SUM(Hours), but this does not work because calculated fields aggregate data.... I was hoping to keep it all in a pivot table so that I can still use slicers.

Pivot Table:

Rows: Years, Months
Values: Tickets (Count), Hours (Sum)
Month
Tickets (count)
Hours(sum)
Throughput (Calculated)

2013

Apr
65
22
2.97

[Code] ..........

## Excel 2007 :: ERROR - Pivot Table Field Name Is Not Valid

Nov 3, 2012

Excel 2007

No empty rows
No empty cells
No calculations in cells

Field names look fine - no punctuation no merged cells

If I select one column - any single column I can generate a pivot table but not with multiple columns

## Using Pivot Table Summary Fields In Calculated Field?

Jan 21, 2012

I am trying to use a summary field in the pivot table in a new calculated filed, but am unable to do so. Let me first describe the context so its easier to understand:

I have a collection of customer purchase records, which look like the following:

Customer Name, Customer ID, Purchase Amount, Activation Date
-------------------------------------------------------------
John , 100 , \$150 , 2011-04-01 17:07:50.0
John , 100 , \$250 , 2011-04-01 17:07:50.0
Paul , 101 , \$125 , 2011-08-20 11:10:27.0

I have several 1000 records like the above and I need to create a summary report which looks like:

Customer Name, Total purchased, Activation date, Avg monthly purchase
-----------------------------------------------------------
John , \$350 , 2011-04-01 , \$175

The average monthly purhcase needs to be calculated based on the date of report generation. So in the case above, the average is calculated as of 2011-06-01.

In order to generate the report above, I created a pivot table with "Customer Name" in the "row labels" section and "Pruchase amount" and "Activation date" in the "values" section of the pivot table. When I try to calculate the "Avg Monthly Purchase", I'm running into the following problems:

1. The activation date is not being displayed as a date, but instead shows 0, when I set the value field settings to "Min"

2. I tried to create the "Avg Monthly Purchase" as a Calculated Field and then use the "Sum of Purchase Amount" field that the pivot table calculates. However, I'm unable to reference the "Sum of Purchase Amount" field in the calculated field.

## Pivot Table - Incorporate Calculated Field For Sub Group

Sep 6, 2012

How to incorporate a calculated field for a sub group.

Here's what the data in the table looks like.

Competitive

Managed

ID
A
B
C
A
B
C

[Code] .....

I am looking to get 3 calculated fields onto the Right hand side that would essentially be the following Formula
=IF(L4"",IFERROR(D4/H4,"n/a"),"")

Thus,
1st Column
=IF(Competitive(A)"",IFERROR(Competitive(A)/Managed(A),"n/a"),"")

2nd Column
=IF(Competitive(B)"",IFERROR(Competitive(B)/Managed(B),"n/a"),"")

3rd Column
=IF(Competitive(C)"",IFERROR(Competitive(C)/Managed(C),"n/a"),"")

The other option would be how to set up conditional formatting to always take on the appearance of Column K of the pivot table. Thus, this calculated section would always appear as though a part of the pivot table and would adjust based on any pivot table items being expanded and collapsed.

## Calculated Field Average Error In Pivot Table?

Dec 10, 2013

I created a custom formula for a pivot table.the existing columns are weekly averages.I made a formula to calculate the average of 5 individual weeks.But when one of the value is blank.Blank cell is considered as zero.and hence the final average is wrong.

## Excel 2007 :: Pivot Table - Daily And Monthly Field Grouping

Oct 17, 2011

I'm using Excel 2007 and am having an issue with grouping/ungrouping fields in pivot tables.

I have 2 separate pivot tables, both from the same named data source, but summarizing different data selections. Both tables include the date field, I am trying to produce both a daily and a monthly table, but whenever I change the grouping/ungrouping of the date field setting on one table, the other table changes to the same grouping.

Is there anyway to have one table with an ungrouped date field and one table with the grouped to month date field?

## How To Create Calculated Field Based Off Two Avg Fields In Pivot Table

Feb 12, 2014

I have a Pivot table that pulls the Avg of two fields for two months, see example below.

Avg Gross \$ Avg Net \$
Jan 2014 20 10
Feb 2014 30 20

sample 1.png
See sample attached.

The Avg Gross and Net is shown by going into the values and selecting "Summarized value by -> Average".

On the right side of this Pivot, what I wanted to do is to show a Avg Gross to Net \$ in this pivot. So the formula should take "Avg Gross \$" - "Avg Net \$" = Avg Gross to Net \$.

I am having trouble calculting this new field in the pivot table using a calculated field because the Calculated field pulls the variables from the existing field list and there isn't a field called "Avg Gross/Net"....I need to find a way to calculate the Avg Gross to Net into the Pivot table so I can pull a pivot graph out of it.

## Create Pivot Table That Has Calculated Field For The Difference In Amount

Feb 27, 2013

I have 3 fields:

Person, FinancialYear, AmountUSD
Pete, FY12, 8000
Pete, FY13, 7000
Jeff, FY12, 5000
Jeff, FY13, 5500
Sam, FY12, 4000
Sam, FY13, 3500

How to create a pivot table that has a calculated field for the difference in AmountUSD between FY12 and FY13 (for each person).

## Excel 2007 :: Formatting Pivot Table Field To Days / Hours And Minutes

Jun 19, 2013

I have data sheet that has a field minutes. I a pivot table I have the Average Minutes per category. How it the pivot table can I show the Average minutes as Days, Hrs, Minutes? I am working in Excel 2007.

## Pivot Table Calculated Field To Subtract Sales Between Two Periods (not Grand Total)

Sep 1, 2011

'Pivot Table Calculated Fields" - Below is my pivot table.

I need the pivot table to subtract 'February' sales figures from 'January' sales figures to get the difference (variance).

I know the following steps:

1) Click on the Pivot Table

2) Choose "Formulas"

3) Choose "Calculated Field"

4) In the "Name" field - type in the name that I want "Two Month Variance" (for example)

5)......then I don't know what to do

Sum of Quantitymonthsupplier idjanfebGrand Total
754466163150842519337568263901785022875682639410025035075682639500
75682639642523866375682639780012492049756826398209209756826399292292
756826400264264756826401178178757494037292292761034919209209867233456264264(blank)
Grand Total245154236931

## Pivot Table: Adding A Percentage Field As '% Of Subtotal'

Nov 21, 2007

In the attached Excel file, there is a pivot table.

In the Data part of the table, there are two columns. The second is the exact same field than the first one but expressed as percentage (Field settings/Options/Show field as "% of" + "Total".

The problem is: I don't want to express this field as a % of Total ('Grand total') but rather as a % of Subtotal (e.g. Danemark Total).

## Excel 2007 :: Pivot Table - Max Number Of Columns?

Nov 9, 2011

I'm using Excel 2007. My pivot table seems to be limiting me to 256 columns in the Values/Data area. In researching below I believe that I should be able to have 16,000 columns in my Pivot Table.

[URL] The "Big Grid" and Increased Limits in Excel 2007

PivotTables Maximum rows displayed in a PivotTable report is 1 million.
Maximum columns displayed in a PivotTable report is 16,000.
Maximum number of unique items within a single Pivot field is 1 million.
Maximum number of fields visible in the Fields list is 16,000.

## Pivot Table - Calculating Percentage Of Two Columns?

May 14, 2014

why it works (but it obviously does). I crabbed off the sheet, modified it with my data and the percentages calculate reliably.

What I can't figure out is that in the Pct calculation in the table is the formula:

=GETPIVOTDATA("S_FCR",PT_1,"Center",[Center],"Date",MONTH([Date]))/GETPIVOTDATA("C_ID",PT_1,"Center",[Center],"Date",MONTH([Date]))^2

The formula itself makes perfect sense in terms of the numbers and filtering involved....but why does it actually work and what does the "^2" do?

## Data Field Of Pivot Table To Go Across Columns

Oct 17, 2007

When i tried to drop another field into data field, by default, the new data field will appear below the field which was already in there. However, i would like the new field showing in an new column - horizontally - rather than showing in a new row.

For example:
Rather than the Pivot table appear like this:

Q108A 72
____B84
____C68
____D5
Q109A 64
____ B 73
____C58
____D 5

I would like the privot table present like the following format:

____ A_ B_ C_ D_
Q108 72 84 68 5
Q109 64 73 58 5

Is there setting I can change, so that the new field is added to a new column.

## Sumif Function In Pivot Calculated Field?

Mar 20, 2007

I'm getting an error message in when I attempt to create a pivot table calculated field formula using the SUMIF function. My questions are (A) Can SUMIF be used in a pivot table calculated field and (B) If Yes, then why am I getting an error message? To expand more on my second question(B). My scenerio is as follows.

I need to compute the Total Inventory Value (Quantity X Cost) of all our inventory that is aged over 60 days. I have a "Total Value" field that gives me the inventory value at a sku level. also have a "Days Since Last Receipt" (DSLR) field that gives the Days since the Inventory was last Received at a sku level. For Example:

SKU A --Total Value=\$100 -- DSLR=50
SKU B --Total Value=\$75 -- DSLR =70
SKU C --Total Value=\$40 -- DSLR =80

Using the above scenerio and example I tried to execute this calculated field formula: =SUMIF(DSLR,">60",Total Value). However I get an formula error message.

## EXCEL 2007 :: How To Make Percentage Of Running Total In Pivot Tables

Jan 15, 2014

how to make a % of running total in pivot tables in excel 2007. the running total in is only available not the "%".