+ Reply to Thread
Results 1 to 3 of 3

xlPercentDifferenceFrom Problem

  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?

    Please Login or Register  to view this content.
    Last edited by dssrun209; 12-06-2011 at 10:15 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: xlPercentDifferenceFrom Problem

    Hi,

    You could always the ABS() workbook function
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

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

    Re: xlPercentDifferenceFrom Problem

    But how can you apply that in the code when there is already a constant xlPercentDifferenceFrom...can you create your own calculation there? Because I just want the ABS of the denominator not necessarily the whole formula, because it will be negative at times (e.g. value 1 is 15 and value 2 is 5. (5-15)/15)

+ 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