Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Pivot Field Function Code

hey guys

Below is a the code I use to calculate (summarize) a
particular pivot field in my pivot table:

With ActiveSheet.PivotTables("PivotTable1").PivotFields
("% Overdue")
.Orientation = xlDataField
.Caption = "Percent Overdue"
.Position = 1
.Function = xlAverage
End With

As you can see the .Function tells the field how to
calculate.

Is it possible to put a custom formula in there such as:
..Function = (Total28- 'On Time28')/ Total28


When I do this VBA highlights it in red. Is there a way
to do this?



Thank you
Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Pivot Field Function Code

Hi Todd
AFAIK this is not possible (you can't use custom function if you use
the wizard)

--
Regards
Frank Kabel
Frankfurt, Germany


Todd Huttenstine wrote:
hey guys

Below is a the code I use to calculate (summarize) a
particular pivot field in my pivot table:

With ActiveSheet.PivotTables("PivotTable1").PivotFields
("% Overdue")
.Orientation = xlDataField
.Caption = "Percent Overdue"
.Position = 1
.Function = xlAverage
End With

As you can see the .Function tells the field how to
calculate.

Is it possible to put a custom formula in there such as:
.Function = (Total28- 'On Time28')/ Total28


When I do this VBA highlights it in red. Is there a way
to do this?



Thank you
Todd Huttenstine


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Pivot Field Function Code

What happens if I dont use the wizard?

Can I specifiy in the code I have the special formula I
want to use?

I need it to use the formula:
(Total28- 'On Time28')/ Total28

-----Original Message-----
Hi Todd
AFAIK this is not possible (you can't use custom function

if you use
the wizard)

--
Regards
Frank Kabel
Frankfurt, Germany


Todd Huttenstine wrote:
hey guys

Below is a the code I use to calculate (summarize) a
particular pivot field in my pivot table:

With ActiveSheet.PivotTables

("PivotTable1").PivotFields
("% Overdue")
.Orientation = xlDataField
.Caption = "Percent Overdue"
.Position = 1
.Function = xlAverage
End With

As you can see the .Function tells the field how to
calculate.

Is it possible to put a custom formula in there such as:
.Function = (Total28- 'On Time28')/ Total28


When I do this VBA highlights it in red. Is there a way
to do this?



Thank you
Todd Huttenstine


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Pivot Field Function Code

Hi
if nearly all cases VBA does NOT provide more features than the GUI. So
in this case as you can't do this manually also VBA does not support
this feature (using custom formulas in the pivot table). One workaround
could be to use a helper column in your source data in include this
helper column in your pivot table as data item (depend on the type of
your formula)

--
Regards
Frank Kabel
Frankfurt, Germany


Todd Huttenstine wrote:
What happens if I dont use the wizard?

Can I specifiy in the code I have the special formula I
want to use?

I need it to use the formula:
(Total28- 'On Time28')/ Total28

-----Original Message-----
Hi Todd
AFAIK this is not possible (you can't use custom function if you use
the wizard)

--
Regards
Frank Kabel
Frankfurt, Germany


Todd Huttenstine wrote:
hey guys

Below is a the code I use to calculate (summarize) a
particular pivot field in my pivot table:

With ActiveSheet.PivotTables ("PivotTable1").PivotFields
("% Overdue")
.Orientation = xlDataField
.Caption = "Percent Overdue"
.Position = 1
.Function = xlAverage
End With

As you can see the .Function tells the field how to
calculate.

Is it possible to put a custom formula in there such as:
.Function = (Total28- 'On Time28')/ Total28


When I do this VBA highlights it in red. Is there a way
to do this?



Thank you
Todd Huttenstine


.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a VB code when you click on the data field of a Pivot Table pgarcia Excel Discussion (Misc queries) 1 March 4th 09 08:27 PM
Pivot Tables - standard Data Field function KDJ Excel Discussion (Misc queries) 1 October 2nd 08 03:22 AM
Excel 2007 Pivot Table - Group Field function is not always availa JLW1 Excel Worksheet Functions 1 October 23rd 07 02:31 PM
How to make a field created a part of the Pivot Table Field List? drhell Excel Discussion (Misc queries) 0 January 29th 07 11:13 PM
Pivot table field swapping in code Janene[_2_] Excel Programming 0 June 9th 04 01:01 AM


All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"