#1   Report Post  
securityman
 
Posts: n/a
Default time


I have set up a spreadsheet with time based on what our company truck
drivers work. We work under a DOT rule of 70 hours / 8 days. That
means that the driver can not work more than 70 hours in an 8 day
period.

The sheets I have (one for each month) goes back 7 days plus the
current day and calculated how many hours a day the driver works and
subtracts it from 70, leaving how many hours they can work the next
day. If the calculation gets to 0 or above, the cell changes color to
alert me that the driver's 70 hours are up and he/she has to have 34
hours off before he/she can be on duty again.

That part of the sheet works perfectly.

I wanted to set up another sheet (in the same workbook) to put their
time in from their time card to automatically calculate how many hours
they worked for the day.
I have it set up for Sunday Monday Tuesday ........ Saturday.

Sunday 17:00
02:29 =9:29
(hours worked that day)

I got that working ok, except when they come on in the evening (say
5:00 pm) and work until after midnite (say 2:29 am). I found a formula
to make this work but don't understand how it works. Can someone
explain how it works?

cell -- a1 17:00 (time in)
cell -- a2 02:29 (time out)

the formula in cell b1 is =(a2<a1)+a2-a1 (how many hours worked)


Also I need a macro (maybe?) to change the results in cell b1:
1. when it says 5:07 -- change to 5:00
2. when it says 5:12 -- change to 5:15
3. when it says 5:35 -- change to 5:30

In other words -- 1-7minutes on the hour
8-22 minutes to the 15 minute mark
23-38 minutes to the half hour mark etc.....


Then I would like for the macro to take those results and put them into
the cells back on the month we are working on (on another sheet - same
workbook) --- so it will calculate how many hours are left for the
driver to work.

I can insert these hours manually by looking at the timecards (because
the driver has already put how many hours he worked that day on it),
but sometimes they don't figure them correctly, but it's best for the
compter to do this as above.

Clear as mud???? I can send the workbook if need be. It 1 mb.

Thanks for any help.....I'll keep working on the macro also....

Don


--
securityman
------------------------------------------------------------------------
securityman's Profile: http://www.excelforum.com/member.php...fo&userid=8829
View this thread: http://www.excelforum.com/showthread...hreadid=379217

  #2   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Can someone explain how it works?
the formula in cell b1 is =(a2<a1)+a2-a1 (how many hours worked)


Excel evaluates dates as integer numbers. One day (24 hours) has a value of
1.

Time is the fractional part of a day (1). A new day starts at 12:00 AM (open
to interpretation) so you must account for that in dealing with time periods
that span past midnight.

The formula is using a boolean test to determine if the time span goes into
the next day.

(a2<a1) will evaluate to either TRUE or FALSE and those boolean values can
be used in math operations. TRUE = 1 and FALSE = 0. So,

02:29 is less than 17:00 so 1 is added to the value in A2 during the
calculation process. So,

A2<A1 = 1
1+A2 = 1.1034722222
1.1034722222 - A1
1.1034722222 - .70833333333

= (in h:mm format) 9:29

To round B1 to the nearest 15 minutes:

=ROUND(((A2<A1)+A2-A1)/(15/1440),0)*15/1440

OR:

=ROUND(((A2<A1)+A2-A1)/TIME(0,15,0),0)*TIME(0,15,0)

Then I would like for the macro to take those results and put them
into.....


Can't help ya with that one!

Biff

"securityman"
wrote in message
...

I have set up a spreadsheet with time based on what our company truck
drivers work. We work under a DOT rule of 70 hours / 8 days. That
means that the driver can not work more than 70 hours in an 8 day
period.

The sheets I have (one for each month) goes back 7 days plus the
current day and calculated how many hours a day the driver works and
subtracts it from 70, leaving how many hours they can work the next
day. If the calculation gets to 0 or above, the cell changes color to
alert me that the driver's 70 hours are up and he/she has to have 34
hours off before he/she can be on duty again.

That part of the sheet works perfectly.

I wanted to set up another sheet (in the same workbook) to put their
time in from their time card to automatically calculate how many hours
they worked for the day.
I have it set up for Sunday Monday Tuesday ........ Saturday.

Sunday 17:00
02:29 =9:29
(hours worked that day)

I got that working ok, except when they come on in the evening (say
5:00 pm) and work until after midnite (say 2:29 am). I found a formula
to make this work but don't understand how it works. Can someone
explain how it works?

cell -- a1 17:00 (time in)
cell -- a2 02:29 (time out)

the formula in cell b1 is =(a2<a1)+a2-a1 (how many hours worked)


Also I need a macro (maybe?) to change the results in cell b1:
1. when it says 5:07 -- change to 5:00
2. when it says 5:12 -- change to 5:15
3. when it says 5:35 -- change to 5:30

In other words -- 1-7minutes on the hour
8-22 minutes to the 15 minute mark
23-38 minutes to the half hour mark etc.....


Then I would like for the macro to take those results and put them into
the cells back on the month we are working on (on another sheet - same
workbook) --- so it will calculate how many hours are left for the
driver to work.

I can insert these hours manually by looking at the timecards (because
the driver has already put how many hours he worked that day on it),
but sometimes they don't figure them correctly, but it's best for the
compter to do this as above.

Clear as mud???? I can send the workbook if need be. It 1 mb.

Thanks for any help.....I'll keep working on the macro also....

Don


--
securityman
------------------------------------------------------------------------
securityman's Profile:
http://www.excelforum.com/member.php...fo&userid=8829
View this thread: http://www.excelforum.com/showthread...hreadid=379217



  #3   Report Post  
securityman
 
Posts: n/a
Default


Thanks, Biff

The round fuction worked perfectly.

I figured that was the way the other (a2<a1) worked, but wanted to make
sure.

I have some ideas about the other (getting the results from the cell in
my Hours sheet over to the correct cell in one of my Months sheet), so I
will keep working on that.


Thanks for the help,

Don


--
securityman
------------------------------------------------------------------------
securityman's Profile: http://www.excelforum.com/member.php...fo&userid=8829
View this thread: http://www.excelforum.com/showthread...hreadid=379217

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with date and time wayne visser Excel Worksheet Functions 1 June 14th 05 04:10 PM
time differences in a column 68magnolia71 Excel Worksheet Functions 3 May 9th 05 09:46 PM
Time Sheet Calculation Help Needed! sax30 Excel Worksheet Functions 2 April 26th 05 08:08 PM
Time Sheets Lady Layla Excel Discussion (Misc queries) 1 March 23rd 05 03:22 PM
unmet challenge boris Excel Worksheet Functions 2 March 16th 05 02:13 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"