Avatar of jkasavan
Flag for United States of America asked on

TIme Math Excel 2007 PivotTable Calculated FIeld

Greetings Experts:

I have an Access 2007 data source that has information about trucks arriving and departing. The time stamps are text fields in military time, like this:

Arrive     Departure
08:34     11:15
17:59     18:28

I tried to create a calculated field in Excel pivottable to give the elapsed time in minutes, but I am unsuccessful. Every attempt either shows 0, 12:00:00 AM, 00:00 or #VALUE. I tried

=TIMEVALUE(Departure&":00 PM")-TIMEVALUE(Arrival&":00 PM")

plus several other variations along those lines.

When I create a formula to do the time math in a cell outside the pivot table, it kind of works.


If N13 is "14:14" and M13 is "10:26" I get 3.8 hours.

I DID get the elapsed time into the pivottable by including this in the SQL Command Text in the Definition of the Connection properties:

SELECT ....(fields I want)....

....abs((left(Departure,2)*60+right(Departure,2))-(left(Arrive,2)*60+right(Arrive,2))) AS 'Elapsed'....

.... FROM (Access data file)....

The same formula in the Calculated Field dialog of the pivottable didn't work.

So the question is:

How do I get the calculated field in the pivottable to work and not have to resort to using the substring extraction functions in the SQL?

Microsoft Excel

Avatar of undefined
Last Comment
Rory Archibald

8/22/2022 - Mon
Rory Archibald

Can you not just use:

Arrival_time: TimeValue([Arrive])

in your query, and similarly for the Departure?

Yes, TimeValue([Departure])-TimeValue([Arrive]) works in the query. I am able to get the elapsed time by creating the calculation in the query.

But, what I am trying to find out is if there is a way to create the elapsed time as a calculated field in the pivot table.
Rory Archibald

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck