Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date-time averages

Status
Not open for further replies.

pbateman

Programmer
Jul 6, 2004
58
GB
Is there an easy way to calculate the average time for a date-time field?
 
I've done it with the below formula, but it seems a bit long winded:

numberVar tmeTime ;
numberVar Output ;
numberVar x ;


x := x + 1;
tmeTime := tmeTime + (hour({db_field}) * 60) + minute({db_field});


Output := tmeTime \ x;

time(totext(output / 60,0) & ":" & totext(remainder(output,60),0) & ":00");
 
Do a running total. That will give you a choice of mean, median and mode.

Right-click on a field and choose Insert to get a choice of Running Total, Summary and Grand Total.. Or else use the Field Explorer, the icon that is a grid-like box.

It helps to give your Crystal version, since newer versions have extra options, and some extra problems. I use Crystal 8.5.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top