Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I have set up a simple timecard in Excel. There is a time field for clocking in, and another for clocking out. I want Excel to then calculate the number of hours worked. I have looked in the help files but still can't figure it out. Any advice is greatly appreciated! Thanks!

I just tried it using B1-A1, and it worked okay.
A1 and B1 are formatted as TIMEA1 = 08:00
B1 = 16:30Formula in C1 =B1-A1
Answer in C1 was 8:30 ( 8 hours and 30 mins )
Krystyna

Ooops...forgot the rest !
To then convert the answer in c1 to a decimal amount
The formula in D1 is =C1*24
The answer will be 8.5 ( 8 and a half hours )or the formula in C1 could be (B1-A1)*24
Krystyna

This is great advice, however there is one problem... For this to work time in and time out must be set in military time. Is there a way to have a clock in at 9:30 AM and a clock out at 5:00 PM, and still be able to calculate the number of hours worked? Whenever I try this I get an error. Any help is greatly appreciated. Thanks!!!

I got the equations to work okay, using AM/PM time format.
Provided that you format the starting time and finish time as TIME 1:30 PM
and type the time in exactly as 9:30 AM and 5:00 PM, it will compute the hours in decimals.
It won't work if you type am or pm...has to be capitals AM and PM
A1 = 9:30 AM
B1 = 5:00 PMC1 = 7:30
Formula is =B1-A1
Format is TIME 13:30D1 = 7.50
Formula is C1*24
Format is NUMBER to 2 decimal places
Krystyna

Krystyna is right...Changing the format of a cell (ie from military to "standard" time) only changes how it displays. Excel is one of the smartest programs out there, IMHO, and has a universal method of internally computing times, dates, currency, etc. so it doesn't matter which format it is displayed in, as long as it is a time, excel will perform the subtraction appropriately.
-SN

G'day,
Yes, the above is correct, but if you want the equations etc look in your excel directory for a file called examples.xls.
This has an example of exactly what you are trying to achieve.
regards,
Elric

![]() |
Field Range in Access
|
Excel, in a new window..
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |