Results 1 to 3 of 3

xlPercentDifferenceFrom Problem

Threaded View

  1. #1
    Registered User
    Join Date
    09-10-2010
    Location
    N/A
    MS-Off Ver
    Excel 2007
    Posts
    55

    xlPercentDifferenceFrom Problem

    I have code that creates a pivot table with % difference from below. It works just as you would expect but the problem comes in when the first value is negative. For example, I have -10 as the first value and 15 as the second value. Excel calculates this as (15-(-10)) / -10 or -250%, which this should be positive. Are you able to add code to the .calculate below so if the old value is negative divide by its absolute value or is there another method to go about this?

                pt.AddDataField pt.PivotFields("Amount"), "Amount ", xlSum
                With pt.PivotFields("Amount ")
                    .Calculation = xlPercentDifferenceFrom
                    .BaseField = "Month"
                    .BaseItem = "(next)"
                    .NumberFormat = "0.00%"
                End With
    Last edited by dssrun209; 12-06-2011 at 10:15 AM.

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