A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DateDiff calculation



 
 
Thread Tools Display Modes
  #1  
Old July 3rd, 2009, 10:34 AM posted to microsoft.public.access.queries
snowball
external usenet poster
 
Posts: 11
Default DateDiff calculation

I am trying to get an efficiency figure calculation from a start time less a
finish time less the sum of personal breaks and m/c breaks.

Start time = Tin
Finish Time = TOut
start -less finish Time = workedT
personal breaks = Pbreak
Machine downtime = M/C break

I have managed to calculate the WorkedT by using the datediff function,
DateDiff("n",[TIn],[TOut])\60 & Format(DateDiff("n",[TIn],[TOut]) Mod
60,"\:00") this is now my workedT,

However i now need to subtract the sum of [Pbreak]+[M/C Break] from my
[worked time] and my answer needs to be in Minutes.

Can anyone help.
  #2  
Old July 3rd, 2009, 12:18 PM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default DateDiff calculation

Try:
DateDiff("n", [Tin], [TOut]) - Nz([Pbreak],0) - Nz([m/c break],0)

This assumes yoru field types a
- Tin Date/Time
- TOut Date/Time
- Pbreak Number (in minutes)
- m/c break Number (in minutes)

If you must Format the result, do so only at the end of the calculation.
Format() generates a string (text), which may not handle further
calculations the way you expect.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"snowball" wrote in message
...
I am trying to get an efficiency figure calculation from a start time less
a
finish time less the sum of personal breaks and m/c breaks.

Start time = Tin
Finish Time = TOut
start -less finish Time = workedT
personal breaks = Pbreak
Machine downtime = M/C break

I have managed to calculate the WorkedT by using the datediff function,
DateDiff("n",[TIn],[TOut])\60 & Format(DateDiff("n",[TIn],[TOut]) Mod
60,"\:00") this is now my workedT,

However i now need to subtract the sum of [Pbreak]+[M/C Break] from my
[worked time] and my answer needs to be in Minutes.

Can anyone help.


  #3  
Old July 3rd, 2009, 02:21 PM posted to microsoft.public.access.queries
snowball
external usenet poster
 
Posts: 11
Default DateDiff calculation

Thanks that helped

"Allen Browne" wrote:

Try:
DateDiff("n", [Tin], [TOut]) - Nz([Pbreak],0) - Nz([m/c break],0)

This assumes yoru field types a
- Tin Date/Time
- TOut Date/Time
- Pbreak Number (in minutes)
- m/c break Number (in minutes)

If you must Format the result, do so only at the end of the calculation.
Format() generates a string (text), which may not handle further
calculations the way you expect.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"snowball" wrote in message
...
I am trying to get an efficiency figure calculation from a start time less
a
finish time less the sum of personal breaks and m/c breaks.

Start time = Tin
Finish Time = TOut
start -less finish Time = workedT
personal breaks = Pbreak
Machine downtime = M/C break

I have managed to calculate the WorkedT by using the datediff function,
DateDiff("n",[TIn],[TOut])\60 & Format(DateDiff("n",[TIn],[TOut]) Mod
60,"\:00") this is now my workedT,

However i now need to subtract the sum of [Pbreak]+[M/C Break] from my
[worked time] and my answer needs to be in Minutes.

Can anyone help.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.