Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Modify a calculated field formula depending upon selection of pagefield

In a pivot table depending upon the selection of a pagefield value I
have to populate the value of a calculated field in row.
Suppose Page field can have selections Income1 , Income2 and All then
my calculated field will use different formula for three selections.

I have tried some thing like this but its not working.

I will really appreciate a quick response.

Private Sub Worksheet_Calculate()

'Call CalculateIncomeSegment
Debug.Print
ActiveSheet.PivotTables("PivotTable1").PivotFields ("Income
").CurrentPage

End Sub

Private Sub CalculateIncomeSegment()

If ActiveSheet.PivotTables("PivotTable1").PivotFields ("Income
").CurrentPage = "(All)" Then
ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _
"Percent in Particular Segment").StandardFormula = "=inc_segA/
apps"

ElseIf ActiveSheet.PivotTables("PivotTable1").PivotFields ("Income
").CurrentPage = "INCOME1" Then
ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _
"Percent in Particular Segment").StandardFormula = "=inc_seg1/
apps"

ElseIf ActiveSheet.PivotTables("PivotTable1").PivotFields ("Income
").CurrentPage = "INCOME2" Then
ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _
"Percent in Particular Segment").StandardFormula = "=inc_seg2/
apps"

End If

End Sub

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
Calculated Field and Calculated Item in Pivot Table Fred Smith Excel Discussion (Misc queries) 0 March 4th 07 09:15 PM
pivot table formulas for calculated field or calculated item Vicky Excel Discussion (Misc queries) 3 June 6th 06 06:06 AM
Using a MIN, MAX formula on a calculated field in a pivot table fhaberland Excel Discussion (Misc queries) 0 August 2nd 05 08:47 PM
How to type correctly formula in calculated field in a pivot? louloutte48 Excel Worksheet Functions 2 June 28th 05 02:46 PM
How do I modify a row depending upon what a cell value is? Brett Patterson Excel Worksheet Functions 5 November 6th 04 05:29 AM


All times are GMT +1. The time now is 05:19 AM.

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

About Us

"It's about Microsoft Excel"