is it possible

HappyChappy

Active Member
Joined
Jan 26, 2013
Messages
383
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
Exel.xlsx
ABCDEFGHIJK
1JanuaryHours WorkedTotal HoursTotal Pay
2Sunday30/01/202200:0000:0000:000:00 
3Monday31/01/202210:0020:0010:009:15£92.50
4Tuesday01/02/202210:0020:0010:009:15£92.50
5Wednesday02/02/202210:0020:1510:159:30£95.00
6Thursday03/02/202210:0014:0004:004:00£80.00
7Friday04/02/202210:0020:0010:009:15£92.50
8Saturday05/02/202210:0016:0006:006:00£120.00
9
10
11RATES
12£10.00Standard RateMin 8 hrs paid as in G6 once 48 is reached Overtime kicks in to all paymnts
13£15.00O/Time Rate
14£12.00Saturday Rate
15£18.00Saturday O/Time Rate
16£15.00Sunday Rate
17£22.00Sunday O/Time Rate
18
Jan-22
Cell Formulas
RangeFormula
E2:E8E2=D2-C2
F2:F8F2=IF(E2>TIME(8,0,),E2-TIME(0,45,0),E2)
G2G2=IF(F2=0,"",MAX(Data!$B$44,F2*24)*$A$14)
G3:G7G3=IF(F3=0,"",MAX(Data!$B$44,F3*24)*$A$12)
G8G8=IF(F8=0,"",MAX(Data!$B$44,F8*24)*$A$16)
B3:B8B3=B2+1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D2:D3Cell Value>0textNO
D2:D3Cell Value>0textNO
D2:D3Cell Value>0textNO
D2:D3Cell Value>0textNO
D2:D3Cell Value>0textNO
D2:D3Cell Value>0textNO
C2:D10Cell Value>0textNO



Trying to work out how to build in hours work over 48 at overtime rate. The sheet can work out minimum hours works of 8hr also breaks of 45 mins need to be factored in once 8:45 is reached
i hope i have pasted the mini sheet correctly as it's my first attempt at this thank you
 
Cell Formulas
RangeFormula
A2:A8A2=+B2
E2:E8E2=IF(COUNT(C2:D2)=2,D2-C2,0)
F2:F8F2=MIN(MAX(0,E2-TIME(8,0,0)),TIME(0,45,0))
G2:G8G2=MAX(TIME(8,0,0),+E2-F2)*(E2>0)
H2:H8H2=MAX(0,MIN(G2,2-SUM($H$1:$H1)))
I2:I8I2=+G2-H2
J2:J8J2=24*($H2*VLOOKUP(WEEKDAY($B2,2),$Q$2:T4,3,1)+$I2*VLOOKUP(WEEKDAY($B2,2),$Q$2:T4,4,1))
K2:K8K2=24*($H2*VLOOKUP(WEEKDAY($B2,2),$Q$2:$T$4,3,1)+0*$I2*VLOOKUP(WEEKDAY($B2,2),$Q$2:$T$4,4,1))
L2:L8L2=24*(0*$H2*VLOOKUP(WEEKDAY($B2,2),$Q$2:T4,3,1)+$I2*VLOOKUP(WEEKDAY($B2,2),$Q$2:T4,4,1))
E10,G10:I10E10=CONCATENATE(24*DAY(E9)+HOUR(E9),":",MINUTE(E9))
F10F10=SUM(F2:F8)
J10:L10J10=J9
B3:B8B3=B2+1


Works Fantastic so thankful for the help can i ask one more question Friday i have entered the start time but as it hasnt ended i cannot enter finish time have tried ifferror in e7 to tidy this cell until value in D7 is entered but to no avail.
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
the formulas in column E suggest that both column C and D must contain a number before calculating the difference.
A workday is a row with a number in C and D.
So if sunday and saturday weren't a workday, C and D have to remain empty and not filled with value 0
Friday, you started at 11:45 and because you say you have no finish time D7 is 0, NO ! D7 should be empty and the formulas don't do anything because there are no 2 numbers.

=IF(COUNT(C2:D2)=2,D2-C2,0)
Perhaps it should be better to add Data>Validation to the cells C2:D8, so that you can only enter a time between 00:00:01 and 23:59:59. (See screenshot, in dutch)
In that way you can only enter a realistic time or leave it empty.

That validation can be more severe, so that the C-column is less than the D-column, but that makes it less workable.
 

Attachments

  • Schermafbeelding 2022-02-11 080755.png
    Schermafbeelding 2022-02-11 080755.png
    13 KB · Views: 9
Upvote 0
the formulas in column E suggest that both column C and D must contain a number before calculating the difference.
A workday is a row with a number in C and D.
So if sunday and saturday weren't a workday, C and D have to remain empty and not filled with value 0
Friday, you started at 11:45 and because you say you have no finish time D7 is 0, NO ! D7 should be empty and the formulas don't do anything because there are no 2 numbers.

=IF(COUNT(C2:D2)=2,D2-C2,0)
Perhaps it should be better to add Data>Validation to the cells C2:D8, so that you can only enter a time between 00:00:01 and 23:59:59. (See screenshot, in dutch)
In that way you can only enter a realistic time or leave it empty.

That validation can be more severe, so that the C-column is less than the D-column, but that makes it less workable.
Data validation works great once again thank you.
 
Upvote 0
As you suggest a contiguous block of data and a macro, you can use currentregion (or usedrange)
VBA Code:
Sub testing()
     Set c1 = ActiveSheet.Range("A1").CurrentRegion
     Set c2 = ActiveSheet.UsedRange
     MsgBox "my current region is : " & c1.Address & ", " & c1.Rows.Count & " rows" & ", " & c1.Columns.Count & " columns" & vbLf & "my usedrange is : " & c2.Address & ", " & c2.Rows.Count & " rows" & ", " & c2.Columns.Count & " columns"
End Sub
 
Upvote 0
As you suggest a contiguous block of data and a macro, you can use currentregion (or usedrange)
VBA Code:
Sub testing()
     Set c1 = ActiveSheet.Range("A1").CurrentRegion
     Set c2 = ActiveSheet.UsedRange
     MsgBox "my current region is : " & c1.Address & ", " & c1.Rows.Count & " rows" & ", " & c1.Columns.Count & " columns" & vbLf & "my usedrange is : " & c2.Address & ", " & c2.Rows.Count & " rows" & ", " & c2.Columns.Count & " columns"
End Sub
was wondering can I ask the spreadsheet is something I access from my phone so macro's don't work well,
I have another puzzle for you the sheet works great by the way. In the transport industry we have two rates of pay day and night
So if you work say from 23:00-04:00 you would get an extra premium on you hourly rate say £1 per hr
so if i worked 12:00 - 01:00 is would get 11 hrs at standard rate and from 23:00 to 01:00 get an extra £2 on top of the std rate can this be factored into the spreadsheet.
 
Upvote 0
my previous post #24 wasn't for this thread, i'm confused :unsure:.
That other question is a little bit tricky because you pass midnight.

If you start sunday 12:00 to monday 01:00, what do you pay ?
12:00 - 24:00 at sunday rate + 23:00-24:00 extra bonus of 1€ (i have no pound-symbol)
00:00 - 01:00 at monday or sunday rate + that same 1€ bonus ?

The same question for a friday and a saturday.
 
Last edited:
Upvote 0
my previous post #24 wasn't for this thread, i'm confused :unsure:.
That other question is a little bit tricky because you pass midnight.
If you start sunday 12:00 to monday 01:00, what do you pay ?
12:00 - 24:00 at sunday rate + 23:00-24:00 extra bonus of 1€ (i have no pound-symbol)
00:00 - 01:00 at monday or sunday rate + that same 1€ bonus I did wonder when i saw the macro LOL
 
Upvote 0
I did wonder when i saw the macro LOL
if you started on the sunday the whole shift would be sunday rate plus the extra £1 premium per hour
same if you worked friday into saturday all paid at the friday rate.
 
Upvote 0
if you start at 00:00 to 12:00 is that bonus also for the hours 00:00-04:00 ?
 
Upvote 0
if you start at 00:00 to 12:00 is that bonus also for the hours 00:00-04:00 ?
any hours from 23:00 to 04:00 will have the bonus £1 added so yes you would get 4hrs x £1 added to the hourly rate for that day
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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