Calculating time 10-29-07

I have a datbase that tracks timein/ timout for employees. I have a time in 
field and a time out field. I have been asked to add a field that calculates 
a persons hours work for that day. How is the simplest way to add this? 
Shifts can rotate, meaning a person may report on monday and 5PM and not 
leave till Tuesday at 3am. time is formated to 24 hour time at the moment.
0
Utf
10/29/2007 5:52:02 PM
access 16762 articles. 3 followers. Follow

3 Replies
935 Views

Similar Articles

[PageSpeed] 13

Below is what I use, there are probably more elegant solutions

Private Sub TimeOff_Exit(Cancel As Integer)

    If Forms!Sales!TimeOff < Forms!Sales!TimeOn Then
        Forms!Sales!TimeChge = (Forms!Sales!TimeOff + 24#) - 
Forms!Sales!TimeOn
            Else: Forms!Sales!TimeChge = Forms!Sales!TimeOff - 
Forms!Sales!TimeOn
    End If

End Sub

"Rhonda" <Rhonda@discussions.microsoft.com> wrote in message 
news:C794D063-73A7-4A56-8741-9A5711DAA3F6@microsoft.com...
>I have a datbase that tracks timein/ timout for employees. I have a time in
> field and a time out field. I have been asked to add a field that 
> calculates
> a persons hours work for that day. How is the simplest way to add this?
> Shifts can rotate, meaning a person may report on monday and 5PM and not
> leave till Tuesday at 3am. time is formated to 24 hour time at the moment. 


0
DL
10/29/2007 6:51:04 PM
On Mon, 29 Oct 2007 10:52:02 -0700, Rhonda <Rhonda@discussions.microsoft.com>
wrote:

>I have a datbase that tracks timein/ timout for employees. I have a time in 
>field and a time out field. I have been asked to add a field that calculates 
>a persons hours work for that day. How is the simplest way to add this? 
>Shifts can rotate, meaning a person may report on monday and 5PM and not 
>leave till Tuesday at 3am. time is formated to 24 hour time at the moment.

The simplest way would be to store both the date and time in the time in/time
out fields. Access stores dates as numbers - a count of days and fractions of
a day (times) since midnight, December 30, 1899. A pure time field (regardless
of format) is stored as a time on that long-ago day - that is, 6:00pm is
stored as 0.75 and corresponds to 6pm, December 30, 1899. If you store the
date and time in the field, then 4am October 31 is actually eight hours after
8pm October 30 rather than 16 hours before!

If you want hours and fractions of an hour, you can use the DateDiff()
function to calculate the minutes worked and divide by 60. With the date and
time it's simple:

DateDiff("n", [Time In], [Time Out]) / 60.

If you store only the time not the date you need to correct for times wrapping
around midnight; on the assumption that the time will never exceed 24 hours,
you can use

DateDiff("n", [Time In], [Time Out]) / 60. + IIF([Time In] < [Time Out], 24,
0)

to add 24 hours to the -16 that the expression will calculate on its own.

The "n" in the DateDiff function is for miNutes - "m" is Months.

             John W. Vinson [MVP]
0
John
10/30/2007 6:40:41 PM
I just new there had to be a more elegant solution :)

"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message 
news:u7uei3p3mmln8jse3qteg360tssgtosps2@4ax.com...
> On Mon, 29 Oct 2007 10:52:02 -0700, Rhonda 
> <Rhonda@discussions.microsoft.com>
> wrote:
>
>>I have a datbase that tracks timein/ timout for employees. I have a time 
>>in
>>field and a time out field. I have been asked to add a field that 
>>calculates
>>a persons hours work for that day. How is the simplest way to add this?
>>Shifts can rotate, meaning a person may report on monday and 5PM and not
>>leave till Tuesday at 3am. time is formated to 24 hour time at the moment.
>
> The simplest way would be to store both the date and time in the time 
> in/time
> out fields. Access stores dates as numbers - a count of days and fractions 
> of
> a day (times) since midnight, December 30, 1899. A pure time field 
> (regardless
> of format) is stored as a time on that long-ago day - that is, 6:00pm is
> stored as 0.75 and corresponds to 6pm, December 30, 1899. If you store the
> date and time in the field, then 4am October 31 is actually eight hours 
> after
> 8pm October 30 rather than 16 hours before!
>
> If you want hours and fractions of an hour, you can use the DateDiff()
> function to calculate the minutes worked and divide by 60. With the date 
> and
> time it's simple:
>
> DateDiff("n", [Time In], [Time Out]) / 60.
>
> If you store only the time not the date you need to correct for times 
> wrapping
> around midnight; on the assumption that the time will never exceed 24 
> hours,
> you can use
>
> DateDiff("n", [Time In], [Time Out]) / 60. + IIF([Time In] < [Time Out], 
> 24,
> 0)
>
> to add 24 hours to the -16 that the expression will calculate on its own.
>
> The "n" in the DateDiff function is for miNutes - "m" is Months.
>
>             John W. Vinson [MVP] 


0
DL
10/31/2007 1:03:52 AM
Reply:

Similar Artilces:

Calculating Taxes and Making calculations
Hello, Kindly plz tell me how do i go about making some small calculations based on my existing data such as how to compute taxes and do other calculations based on some quantitative data. where exactly do i make modifications on my application??? Kindly help me out. Thanks , swati you can add code in javascript behind dropdowns or piclist fields. One example might be a dropdown which has shipping options ie ups, fedex etc. When you choose one it takes the weight of your package (whcih you enter) then calculates a shipping cost. search the archives of this group at groups.google.com and ...

Procedure to calculate distance using latitude/longitude
Does anyone know of a vba procedure for access that will calculate straightline distance using latitude and logitude for 2 points? AJ wrote: > Does anyone know of a vba procedure for access that will calculate > straightline distance using latitude and logitude for 2 points? See: http://groups.google.com/group/microsoft.public.access/msg/6b934b0e580b974b James A. Fortune MPAPoster@FortuneJames.com ...

How to calculate age of a person?
Hi, I'm struggling to figure this one out. I have a date column and I'd like to be able to calculate the age without doing it in my head. I've tried to do this but am struggling. Any help will greatly appreciated. Thanks Suzanne Visit www.cpearson.com and search for DATEDIFF best wishes -- Bernard V Liengme Microsoft Excel MVP www.stfx.ca/people/bliengme remove caps from email "Grd" <Grd@discussions.microsoft.com> wrote in message news:6BFFD11C-AECB-4837-93B6-D84B6170B975@microsoft.com... > Hi, > > I'm struggling to figure this one out. I have...

average if with time
I have data sorted by date(mm/dd/yy) and time(hh.mm.ss) and I am tryin to write a function which will average every hour. How can I sor through the times and compute an average without getting all the 2 clocks, for example, as opposed to the hour on one particular day Thanks for the help, Andrew Moo -- Message posted from http://www.ExcelForum.com Need a little more detail. Maybe give me an example of what you have a data and then tell me what results you are trying to recieve from tha data! michae -- Message posted from http://www.ExcelForum.com I see your problem as having separate...

Due Date Calculated
I need assistance on an expression that allows for the due date of recurring training to be one year from date completed. Details are as follows: I have a form named [frmTRNComplete] based on table named [tblTRNComplete] Form controls are: TRNID (combo box), DateComp (Text Box) , DateNext (text box), Reccuring (check box) I would like the DateNext to be 1 year from DateComp if Reccuring is true and Date next to be blank if Reccuring is false. -- Aloha, Ron A. Ron I'll assume that you want to use the form to calculate the DateNext, and that you are not trying to s...

DROP DOWN MENUS #10
i would like to link my drop down menus with an if, then scenario. If product a is selected, then product 1&2 are availble but if product b is selected, then product 1,2,3 & 4 are available. Does anyone know how to do this in an Excel document? Please let me know. Thanks. ...

EXCEL 2007 Formula to calculate INTEREST only on a 3 month bridge
I am trying to calculate monthly INTEREST ONLY payment on a short term bridge/swing loan. Assuming an interest rate of 2.75%, paid monthly, Also assuming it will be required for a 3-6 month period, amount approx $500,000. Just switched to Excel 2007 but don't seem to be able to calculate using the formula builder. Not sure if it is compounded daily or monthly. You might want to check out the IPMT function. From the XL help file: IPMT(rate,per,nper,pv,fv,type) Rate is the interest rate per period. Per is the period for which you want to find the interest and must...

how to calculate outliers
Google is your friend: http://www.google.com/search?q=calculate+outliers - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "ismhs" <ismhs@discussions.microsoft.com> wrote in message news:035124A0-06FA-4153-932E-6C4E0614F38C@microsoft.com... > ...

Time Conversion question
One of the pieces of software we use gives us time in an awkward format. 16633 means 166 minutes 33 seconds. I need a formula to convert this figure to a decimal respresentation of time (166.55 for the example listed previously). Any help will be much appreciated. =INT(A1/100)+MOD(A1,100)*5/300 HTH. Best wishes Harald "Sean Skallerud" <SeanSkallerud@discussions.microsoft.com> skrev i melding news:050BD3C6-E67A-4F94-B08B-695A038B33A6@microsoft.com... > One of the pieces of software we use gives us time in an awkward format. > 16633 means 166 minutes 33 seconds. I...

Calculated field options???
Here's my Data: Country Status --------- ---------- Canada Green Canada Blue Canada Green Canada Green Canada Blue In my pivot table, 'Country' is an item, and 'Status' is my only data field. What I really need to show in my data area is two column of data, one for 'Green' and one for 'Blue'. I tried creating two 'Calculated' fields with the following formulas, but they don't seem to be working: 'CalculatedField1' = IF((STATUS="Green"),1,0) 'CalculatedF...

Time Sheet Function to Calculate
I am having some trouble trying to establish a formula that will give me the number of hours worked during the day given the start time say 8.30am with an end time of 5.30pm and say 30 minutes for lunch. For this scenario, total working hours would be eight and a half hours but I need Excel to display this result as 8.30 hours (0.30 being the minutes in the half hour) and not 8.50. Can someone suggest what to do? Typically the layout would be Column A - Start Time say 8.30am Column B - Time in minutes spent at lunch say 30 minutes Column C - End Time say 5.30pm. Column D - the calculati...

10.1.4 update won't install
When I run the 10.1.4 updater on my iBook I end up with an error message which says that the installer is unable to find the Office X folder on my hard drive. At some point I think I renamed the folder "MS Office X", so I thought that was the reason and renamed it back to "Microsoft Office X". That still didn't work. How can I get this update installed? I tried installing it from within the same folder that Office resides in, but that didn't work either. You need to install the 10.1.2 update first, ...

DCount Problem 04-01-07
This DCount Doesn't seem to returning the value I'm asking for. It's counting the number of all the checks as opposed to the number of ChkWalkouts for a server. DCount("ChkWalkOut","tblChecks","ChkServer = " & Reports!rptCashOutServer!ChkServer AND "ChkWalkOut=-1") Any help is appreciated. Thanks DS In news:QCRPh.134$Z97.132@newsfe12.lga, DS <bootybox@optonline.net> wrote: > This DCount Doesn't seem to returning the value I'm asking for. It's > counting the number of all the checks as opposed to the number...

tenure calculations
how can I format several dates such as 04/19/2003, 04/01/2004, etc. int a yearly average for the employee tenure -- Message posted from http://www.ExcelForum.com right now say I have my yearly figures in i1-i9. The formula I though would work is =today()-average(i1:i9), but how would i format this to give me yearly read out -- Message posted from http://www.ExcelForum.com Hi djackson! One way is to use YEARFRAC with a third argument of 1 to get your tenures in years and fractions of a year and then average the result. However YEARFRAC does produce some annoying but small errors. Y...

word not responding 01-29-10
whilst doing a spell check Microsoft word has frozen - how can I unfreeze it without losing all of my written work? ...

Dynamics GP 10 on Windows 2000
We're about to try to upgrade from Great Plains 8.0 to 10.0. We have a Windows 2000 server with SQL 2000 where our existing GP 8.0 is installed. We ALSO have a Windows 2003 SBS... we're NOT using SQL on that machine... and don't want to. (Please save each of us a response, and don't ask me why...) Can we install the GP 10.0 server programs on the SBS 2003 server and point to the Windows 2000/SQL 2000 database server? Yes, you can install the 'Server' application on SBS 2003 or even an XPSP2 workstation. All you need are the SQL 2000 tools installed on the m...

Can't send email 06-08-10
I could send last night and since then I can't send anything. I keep getting this message: Your SMTP server has not responded in 60 seconds. Would you like to wait another 60 seconds for server to respond? I've clicked yes many times and continue to get the same thing. So I click stop and this is the error message I get. Subject '',Server: , Protocol: SMTP, Port: 25, Secure(SSL): No, Error Number: 0x800CCC19 PLEASE HELP!!!! Much of the error message is missing. Please post the error message in its entirety. You can left click on it to highlight and then ...

Formula to calculate time
I was wondering if anybody knows of a formula to allow you to do calculations based on time. In other words, say I want to put a list of songs on a CD and their durations. Then, I want to add up the durations to get the full time of the CD, or my specific play list. So for example, using the information below: Ghostbusters - Ray Parker Jr. --- 5:23 (Just a guess) Phantom of the Opera Overture --- 3:55 (Another guess) Instead of 8:78, I'd want to see 9:18 Can this be done? Any help would be greatly appreciated. Thank you! -- Have a nice day! ~Paul Express Scripts, Charting the futu...

Not Windows but Chicago Hawks win Stanley Cup
Chicago Blackhawks defenseman Brent Seabrook kisses the Stanley Cup after the Blackhawks stunned the Philadelphia Flyers 4-3 in overtime, capturing their first championship in 49 years. As you might guess, Hockey's key competition is named after me. Just kidding. P.S. I didn't know hockey is so active during Summer time, it was 90 degrees here the past week and we're not far from Chicago. Stanley Starinski I have a goat on Route9, NJ at my farm! "Ibrahim Al-Qassam (Abdelaziz)" <IranWillRuleWorld@alibaba.ir> wrote in message news:hure3v$...

Insert calculated median field in pivottable
Anyone know how to get a median calculation in a pivot table? I've tried inserting a calculated field but it always sums the calculated field. Thanks, Joel Not supported in a pivot -- Regards, Peo Sjoblom (No private emails please) "Joel Schaefer" <joel@disintegrators.com> wrote in message news:ev4P0Nk6FHA.2616@TK2MSFTNGP15.phx.gbl... > Anyone know how to get a median calculation in a pivot table? I've tried > inserting a calculated field but it always sums the calculated field. > > Thanks, > > Joel > ...

Is it possible to have different send/receive patterns at different times?
Basically, here's what I want to happen. >From 8-5 or so, Outlook downloads my e-mail automatically with Send/Receive. At 5 or 5:30, when I leave the office, Outlook stops, and I can check my e-mail through our web interface. The simple approach is to just close Outlook, but I tend to forget to do that. So is there a way to set it, either with or without an add-in? Justin <jmeyer@incrementaladvantage.com> wrote: > Basically, here's what I want to happen. >> From 8-5 or so, Outlook downloads my e-mail automatically with > Send/Receive. At 5 or 5:30, when I le...

Data Migration Framework 02-08-07
Hi, i want to import data from crm so i begin to install MDF and i do all the steps but when i want to clean CDF i find this [img]http://www.geocities.com/yanise213/crm_import.JPG[/img] my question is: the cdf_systemuser and cdf_territory are full. why any data are mapping ? ...

Approving time sheets in Business Portal
A user is modifying a timesheet that was previously returned by a supervisor. The timesheet has a status of "Returned". The user corrects the information and when proceed to save the following message appears: Microsoft.Dynamics.Pma.Pma.Cost Category. [Cause] The entity, Timesheet, accessed by the user failed security validation. [Correction] The system should accept a query or update for the entity that the user has..(final part of message is not displayed). The timesheet was made using Business Portal 2.5. Great Plains version is 8.0 Any suggestion on the cause of this er...

Photo out of focus when inserted in Publisher 07
A perfectly in-focus photo becomes out of focus when inserted in Microsoft Publisher 07. View, Pictures, make certain Detailed Display is checked. -- Mary Sauer http://msauer.mvps.org/ "The Documentalist" <The Documentalist@discussions.microsoft.com> wrote in message news:36D7F251-79CC-4842-AEE3-C879E81DF5B0@microsoft.com... >A perfectly in-focus photo becomes out of focus when inserted in Microsoft > Publisher 07. a perfectly in focus pic becomes out of focus in MS Publisher Posted as a reply to: Photo out of focus when inserted in Publisher 07 A perfectl...

coucou 03-06-07
Bonjour,Voici la nouvelle adresse de Rosette´┐Ż+...