Overtime payroll sheet nightmare!

Richskelly

New Member
Joined
Dec 8, 2018
Messages
4
Hi I am trying to create an overtime sheet for my Hospital's salaries department and I am stuck!

They need to have an out put of the exact hours worked (eg 09:00-17:00) for each day.
Some people my work onsite in the hospital on several occasions per day so the exact hours for these need to be recorded (eg 09:00-17:00 and 19:00-22:00).

The time sheet makes us fill out each hour with an "x" for on site and an "o" for off site in a row of 24 boxes per day representing each hour of that day.

So what I need is, if there are 2 or 3 periods of onsite work per day (represented by a row of x's). can someone give me a formula to convert these to individual time periods in a box at the end of the row (eg 09:00-17:00, 19:00-22:00 and 23:00-00:00)

We currently have a time sheet which cant change in its appearance very much or they wont accept it.

PLEASE CAN SOMEONE HELP ME!!!!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
What about using
Code:
[TABLE="width: 64"]
<tbody>[TR]
  [TD="width: 64, align: right"]=COUNTIF(A2:X2,"x")[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Thanks for your reply,
I've done that to add up the hours but I need to produce the range of exact times of coming in and going out (e.g. 09:00-17:00) and I need to replicate this for each time someone comes in over the course of the day.

I'd really appreciate your help
 
Upvote 0
This UDF will do what you want but i had to make some assumption,
1:I assumed that the array where the x are are in columnn A to X
2: I assumed that the heading for each hour are in Row 1 and that they are TEXT not times. ( if this isn't the case you will just get numbers instead of times0
Code:
Function hrs(arr As Range)

inarr = arr
inwork = False
hrs = ""
fst = ""
For i = 1 To UBound(inarr, 2)
  If inarr(1, i) = "x" And Not (inwork) Then
   inwork = True
   hrs = hrs & fst & Cells(1, i)
   fst = " , "
  End If
  If inarr(1, i) <> "x" And (inwork) Then
   inwork = False
   hrs = hrs & "-" & Cells(1, i) & " "
  End If
Next i
If inwrk Then
   hrs = hrs & "-" & Cells(1, 24) & " "
End If
End Function
 
Last edited:
Upvote 0
Thank you so much for taking the time, I really appreciate your time and help. I never knew that a UDF even existed.
So, looking at that UDF I have no idea how to augment it to suit my workbook. When I put it in as a UDF it just came up with the #NAME ? error

The times are all in as times and not TEXT

I have pasted in the times and first day which I set as 24th Dec below. Taking the first column, the 00:00 time(located in cell c3) is the start of the hour and the 01:00(located in cell c5) is the end of that hour. The "o" in cell c6 shows off site for that hour. This repeats itself in row 6 from c to z

Another layer of complexity is that when someone comes in on the half hour I have noted this as either 1/2x if they werent on off site call before ore after or 1/2x+o, as you can see in the hour 08:00-09:00 and again in the 17:00-18:00 cell below, if they are coming in or leaving the hospital on the half hour while on off site call.

I have added into this line a mock up of the calculations i need in the last 6 columns on far right under "On Site hours" and "Off Site Hours"

Calculating the on site hours is more important than the off site hours as these could be easily figured out
00:0001:0002:0003:0004:0005:0006:0007:0008:0009:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:0022:0023:00Hours Worked On SiteTotal On Site hoursHours On Call Off SiteTotal Off Site hoursOn Site TimesOn Site TimesOn Site TimesOff Site TimesOff Site TimesOff Site Times
totototototototototototototototototototototototo
DateDay01:0002:0003:0004:0005:0006:0007:0008:0009:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:0022:0023:0000:00
24th DecMonoooooooo1/2x+oxxxxxxxx1/2x+ooooooo99151508:30-17:3020:00-23:00 00:00-08:3017:30-21:0023:00-00:00

<colgroup><col><col><col span="24"><col><col><col><col><col span="3"><col span="3"></colgroup><tbody>
</tbody>



Thank you so much again for your help. If I can send you the workbook, please tell me, it might make this much easier as I'm completely new to excel
 
Upvote 0
This is a completely different problem compared to your original post. the four columns at the end bear no resemblance to the display you originally asked for e.g (09:00-17:00 and 19:00-22:00) .
My original response suggesting countif will sum the hours worked on site for you, although you will have to deal with the really odd format you have decide to use for half hours. What is the difference between hours worked on site and total hours on site?
How are you doing the hours on call off site.
This is all a bad case of MISSION CREEP, and I suspect you still haven't told me the whole story.
I am sorry but I can't spend any more time on this one.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top