Use the DateDiff function
DateDiff("s",[Sign In Time],[Sign out Time])
The average would be
Avg(DateDiff("s",[Sign In Time],[Sign out Time]))
To DISPLAY that in minutes and seconds
Avg(DateDiff("s",[Sign In Time],[Sign out Time])) is Seconds
Avg(DateDiff("s",[Sign In Time],[Sign out Time]))\60
is minutes
So putting that all together.
Avg(DateDiff("s",[Sign In Time],[Sign out Time]))\60 & ":" &
Format(Avg(DateDiff("s",[Sign In Time],[Sign out Time])),"00")
Total handle time
Sum(DateDiff("s",[Sign In Time],[Sign out Time]))
Expressing that as hours and minutes
Sum(DateDiff("s",[Sign In Time],[Sign out Time]))\3600 & ":" &
Format((Sum(DateDiff("s",[Sign In Time],[Sign out Time])) Mod 3600)
\60,"00")
'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
In the query I have the following:
Handle Time: [Sign In Time]-[Sign Out Time]
Example:
Sign In Time 7:00:00 AM - Sign Out Time 6:00:00 AM = Total Handle Time
1:00
Now if I divide that by the number processed 22 = 02:44 (nn:ss) Average
Handle Time per email.
However, when I run the report for a longer date range, the Total Handle
Time exceeds a 24 hour period, so I have to use the expression below to
show total hours. When I use this expression, the Average Handle Time
gives an error. Is there a way to have it reference the sum of the Total
Handle Time and then divide it by the number processed?
Klatuu said:
How do you do that?
The DateDiff function only returns one value, Years, Months, Weeks,
Days, Hours, Minutes, or Seconds. It will not return both.
If you can post the code where you populate the field. And the data
type of the field, I will be happy to help.
I'm trying to calculating an averge handle time using total number of
processed emails divided by the total handle time. However, since the time
could be longer than 24 hours, I'm using the following expression
=Int(CSng(Sum([Handle Time])*24)) & ":" & Int(CSng(Sum([Handle
Time])*1440))-Int(CSng(Sum([Handle Time])*24))*60 & ":" &
Int(CSng(Sum([Handle Time])*86400))-Int(CSng(Sum([Handle Time])*1440))*60
This is causing the average field to have an error. How can I correct that?
Additionally, I would like the total handle time to be in an hh:nn format,
but it won't save. It keeps changing back to Short Time, which displays
hh:nn:s. Is there any way to correct this?
BruceM said:
I don't see the point of the Sum function. Also, I think Mod is for VBA
only. What exactly do you wish to see for the output?
Whitney said:
I'm getting the following error:
This expression is typed incorrectly, or it is too complex to be
evaluated.
For example, a numeric expression may contain too many complicated
elements.
Try simplifying the expression by assigning parts of the expression to
variables. (Error 3071)
I'm using the follwing expression in the query:
Total Handle Time: Sum(DateDiff("s",[Sign Out Time],[Sign In Time]))\3600
&
":" & Format((Sum(DateDiff("s",[Sign Out Time],[Sign In Time])) Mod
3600)\60,"00")
What am I missing?