+ Reply to Thread
Results 1 to 2 of 2

Pivot Table help!

Hybrid View

  1. #1
    Mike Fogleman
    Guest

    Pivot Table help!

    Is there a specific news net that deals with pivot tables? Or any web sites?
    My problem is I have a calculated field that will divide a field number by a
    monthly constant. My page field is the Month column so I can select any of
    the months to display in the pivot table. However, the constant in the
    calculated field is different for each month. Right now I have 12 copies of
    the same pivot table, each displaying a different Month, then I edit the
    constant for each table. So I really have a variable constant for each
    month. Is there a way to tell the calculated field to use a certain constant
    depending upon which month is selected in the page field? That would let me
    get rid of the other 11 table copies.

    Mike F



  2. #2
    Debra Dalgleish
    Guest

    Re: Pivot Table help!

    You could use a worksheet formula to return the value for the month
    selected in the page field, e.g.:

    =VLOOKUP(B3,MonthLU,2,0)

    Then, use the PivotUpdate event to change the calculated field, e.g.:

    '==========================
    Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    Dim lMonth As Long
    lMonth = Me.Range("MonthValue").Value

    Application.EnableEvents = False
    Me.PivotTables(Target.Name).CalculatedFields("MonthDiv") _
    .StandardFormula = "=Units/" & lMonth
    Application.EnableEvents = True

    End Sub
    '============================

    Mike Fogleman wrote:
    > Is there a specific news net that deals with pivot tables? Or any web sites?
    > My problem is I have a calculated field that will divide a field number by a
    > monthly constant. My page field is the Month column so I can select any of
    > the months to display in the pivot table. However, the constant in the
    > calculated field is different for each month. Right now I have 12 copies of
    > the same pivot table, each displaying a different Month, then I edit the
    > constant for each table. So I really have a variable constant for each
    > month. Is there a way to tell the calculated field to use a certain constant
    > depending upon which month is selected in the page field? That would let me
    > get rid of the other 11 table copies.
    >
    > Mike F
    >
    >



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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