Pivot Table Not Displaying Negative Time Values

fadetograham

New Member
Joined
Jul 6, 2015
Messages
39
Hi everyone

I have a pivot that needs to show a planned journey time, actual journey time and then the variance. The problem I have is that the calculated field in the pivot won't display the negative values in the variance where the journey took less time than planned. It just displays #######, which invalidates the subtotals too.

Outside of the pivot table I can get the figures I need by using the below formula where E4 is actual time and D4 is planned time. When I adjust it for use in a calculated field (swapping e4 for 'actual' etc) it doesn't work. =IF(e4-d4<0, "-"&text(abs(e4-d4),"h:mm"), e4-d4)

Is there an adjustment to the basic =actual-planned formula in the calculated field which will get it to show the correct figure?

Thanks in advance for any help you can give.
Graham
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
You could use:

=(Planned-Actual)*IF(Actual>Planned,-1,1)
 
Upvote 0
Hi Rory

Thanks for the quick response but unfortunately that doesn't seem to have worked. It's zero'd all negative figures and ###### all the positive figures.

Regards
Graham
 
Upvote 0
I don't see how that could possibly zero anything since it multiplies by either 1 or -1.

However planned and actual should be transposed in both parts of the formula!
 
Last edited:
Upvote 0
My apologies, it's showing zero where there wasn't a difference between plan and actual but both positive and negative values are showing as #######.

The formula bar does shows a figure but it's showing as a decimal and no amount of column widening shows it in the pivot.
 
Upvote 0
What formula are you using currently in the calculated field?
 
Upvote 0
It should be:

=(Actual-Planned)*IF(Planned>Actual,-1,1)
 
Upvote 0
Yeah I changed it to that but it ####### all values other than those without a difference so I changed to back to the just actual-plan.

Your formula does work fine outside of a pivot although it does display everything as a positive value, which will give a false total when looking at multiple journeys. As soon as I place the formula in a calculated field and transpose for the pivot it doesn't display anything other than 0:00 for where there is no difference between plan and actual.

I find it bizarre that formulas in pivot tables behave differently to those outside and such a simple metric is so hard to get from in a pivot.

Thanks for your time and help trying to sort this, it's much appreciated.
 
Upvote 0
I tested that in a calculated field and it worked as expected. Can you provide a workbook where it doesn't?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top