Overtime formula to determine correct pay rate determined by time and day

%3CLINGO-SUB%20id%3D%22lingo-sub-2464737%22%20slang%3D%22en-US%22%3EOvertime%20formula%20to%20determine%20correct%20pay%20rate%20determined%20by%20time%20and%20day%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2464737%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EHi%20Team%2C%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EHoping%20I%20can%20be%20pointed%20in%20the%20right%20direction%2C%20as%20I%20am%20close%20but%20not%20quite%20there%20in%20calculating%20a%20formula%20for%20the%20following%20scenario%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EOvertime%20on%20Sunday%20is%20double%20pay%20regardless%20of%20the%20hours%20worked%20(This%20works!!)%3CBR%20%2F%3E%3CSPAN%3EAny%20Overtime%20between%2023%3A00%20-%2007%3A00%20(Monday%20-%20Saturday)%20is%20double%20time%20(This%20works)%3CBR%20%2F%3E%3CSPAN%3EAny%20overtime%20between%2007%3A00%20-%2023%3A00%20is%20time%20and%20a%20half%20for%20first%203%20hours%2C%20then%20double%20time%20after%20that%20(This%20works)...%26nbsp%3B%3CU%3Eexcept%3CSPAN%3E%26nbsp%3B%3CSPAN%3Efor%20when%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FU%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CI%3E-%20The%20time%20entered%20is%20between%20the%20hours%20of%2020%3A00%20-%2022%3A00.%20This%20time%20window%20should%20be%20at%20time%20and%20a%20half%2C%20but%20it%20calculates%20as%20time%20and%20a%20half%2C%20and%20a%20negative%20double%20time.%20This%20results%20in%20the%20incorrect%20rate%20being%20paid%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EMy%20formula%20is%20looking%20to%20determine%20what%20is%20classified%20at%20time%20and%20half%2C%20but%20this%20doesn't%20seem%20to%20compute%20for%20these%20hours%2C%20and%20I%20can't%20see%20why.%20I%20have%20tried%20using%20the%20round%20formula%20and%20this%20does%20improve%20slightly%20but%20still%20not%20correctly.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EMy%20formula%20is%20in%20Column%20R%20in%20attached%20spreadsheet%20(I%20wasn't%20able%20to%20show%20the%20formula%20here)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3D(IF(WEEKDAY(OT_Start)%26lt%3B%26gt%3B1%2C(IF(VALUE(TotalHRS)%26lt%3B%3D3%2CIF(starttime%3CTIME%3E0%2C((Finishtime-TIME(7%2C0%2C0))*24)%2C0)%2C(ActualHRS)))))%2C0)%2C(IF(starttime%3CTIME%3E0%2C(IF(((Finishtime-TIME(7%2C0%2C0))*24)%26lt%3B3%2C((Finishtime-TIME(7%2C0%2C0))*24)%2C3))%2C0))%2CIF((ActualHRS)%26gt%3B3%2C3%2CActualHRS)))))%2C3))))%2C0))%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3Estarttime%20is%20the%20TIMEVALUE%20of%20the%20date%2Ftime%20the%20overtime%20commenced%3CBR%20%2F%3E%3CSPAN%3EFinishtime%20is%20the%20TIMEVALUE%20of%20the%20date%2Ftime%20the%20overtime%20ceased%3CBR%20%2F%3E%3CSPAN%3ETotalHRS%20is%20the%20total%20number%20of%20hours%20and%20minutes%20of%20the%20overtime%3CBR%20%2F%3E%3CSPAN%3EActualHRS%20is%20determined%20if%20you%20need%20to%20return%20to%20work%2C%20or%20if%20are%20recalled%20as%20these%20attract%20a%20minimum%20time%2C%20eg%204%20hrs%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EIn%20addition%2C%20I%20also%20need%20to%20add%20a%20formula%20for%20Public%20Holidays.%20Between%2008%3A00%20-%2017%3A00%20is%20at%20time%20and%20half%2C%20and%20outside%20of%20this%20time%20is%20double%20time%20and%20half.%20Public%20Holiday%20is%20flagged%20in%20the%20sheet%20with%20a%20Y%20in%20column%20F.%20I%20am%20struggling%20with%20this%20one!!!%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EMany%20thanks%20for%20looking%2C%20and%20appreciated%20any%20assistance%20you%20can%20provide.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FTIME%3E%3C%2FTIME%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2464737%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2464778%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20formula%20to%20determine%20correct%20pay%20rate%20determined%20by%20time%20and%20day%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2464778%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1082834%22%20target%3D%22_blank%22%3E%40dahbrown%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20only%20issue%20was%20that%20you%20have%20unable%20to%20observe%20that%20in%20Column%20T%20%26amp%3B%20U%20specially%20the%20used%20formula%20was%20subtracting%20smaller%20value%20to%20higher%20that's%20why%20returning%20Negative%20Values%2C%2C%20check%20the%20formula%20in%20both%20Column%20T%20and%20U%20and%20have%20applied%20the%20corrections%2C%20also%20check%20SAMPLE%20CALCULATION%20in%20column%20Y%20%26amp%3B%20Z%2C%2C%2C%20I'm%20sure%20this%20solves%20the%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%20color%3D%22%230000FF%22%3E%3CSTRONG%3EIf%20my%20corrections%20solves%20the%20issue%20then%20you%20may%20accept%20this%20as%20Best%20Answer%20as%20well%20Like.%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2464779%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20formula%20to%20determine%20correct%20pay%20rate%20determined%20by%20time%20and%20day%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2464779%22%20slang%3D%22en-US%22%3EThanks%20Rajesh.%20The%20hours%20in%20Column%20S%20is%20greater%20than%20Total%20hours%20in%20P.%3CBR%20%2F%3EAs%20the%20time%20of%20the%20work%20is%20before%2023%3A00%2C%20this%20should%20be%20time%20and%20a%20half%20and%20should%20only%20appear%20as%20a%20value%20in%20Column%20S%2C%20and%20zero%20hours%20in%20Column%20T%3CBR%20%2F%3E%3CBR%20%2F%3EI%20will%20have%20have%20a%20look%20at%20your%20corrections.%3CBR%20%2F%3E%3CBR%20%2F%3EMany%20thanks%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2464855%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20formula%20to%20determine%20correct%20pay%20rate%20determined%20by%20time%20and%20day%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2464855%22%20slang%3D%22en-US%22%3EZERO%20will%20appear%20in%20col%20T%20only%20when%20either%20of%20the%20columns%20returns%20TRUE%20you%20have%20tested%20with%20Y%2Fy%20%2C%20dn%20or%20N%2Fn%20as%20was%20in%20T7%20also%2C%2C%20when%20Tot%20Hors%20%26amp%3B%20Time%20half%20has%20similar%20values%20as%20T8%20to%20T15%20and%20others%2C%2C%2C%20otherwise%20subtract%20Tot%20Hrs%20from%20Time%20half%2C%2C%2C%20I've%20only%20adjusted%20the%20formula%20to%20avoid%20returning%20negative%20value%20in%20col%20T%20%26amp%3B%20U%20by%20using%20your%20original%20formula%20!!%3CBR%20%2F%3E%3CBR%20%2F%3EAnd%20I've%20a%20question%20that%20why%20you%20are%20working%20with%20TEXT%20data%20for%20Date%20Time%20Stamp%20values%20in%20col%20B%20%26amp%3B%20C%20%2C%2C%20should%20be%20CUSTOM%20dd%2Fmm%2Fyyyy%20hh%3Amm%3Ass%20AM%2FPM%20%2C%2C%20and%20I%20do%20believe%20that%20there%20is%20no%20use%20of%20getting%20Start%20and%20Finish%20time%20in%20column%20M%20%26amp%3B%20N%2C%2C%20you%20can%20straight%20forward%20get%20Actual%20Hours%20by%20subtracting%20value%20from%20Col%20B%20%26amp%3B%20C%20%3F%3F%3C%2FLINGO-BODY%3E
New Contributor

Hi Team,

 

I am using Home & Business 2019 edition.

Hoping I can be pointed in the right direction, as I am close but not quite there in calculating a formula for the following scenario:

Overtime on Sunday is double pay regardless of the hours worked (This works!!)
Any Overtime between 23:00 - 07:00 (Monday - Saturday) is double time (This works)
Any overtime between 07:00 - 23:00 (Monday - Saturday) is time and a half for first 3 hours, then double time after that (This works)... except for when:

 

- The time entered is between the hours of 20:00 - 22:00. This time window should be at time and a half, but it calculates as time and a half, and a negative double time. This results in the incorrect rate being paid

My formula is looking to determine what is classified at time and half, but this doesn't seem to compute for these hours, and I can't see why. I have tried using the round formula and this does improve slightly but still not correctly.

My formula is in Column R in attached spreadsheet:

 

=(IF(WEEKDAY(OT_Start)<>1,(IF(VALUE(TotalHRS)<=3,IF(starttime<TIME(23,0,0),(IF(((TIME(23,0,0)-starttime)*24)<=3,((TIME(23,0,0)-starttime)*24),(IF(starttime<=TIME(7,0,0),IF(((Finishtime-TIME(7,0,0))*24)>0,((Finishtime-TIME(7,0,0))*24),0),(ActualHRS))))),0),(IF(starttime<TIME(23,0,0),(IF(((TIME(23,0,0)-starttime)*24)<=3,((TIME(23,0,0)-starttime)*24),(IF(starttime<=TIME(7,0,0),(IF(((Finishtime-TIME(7,0,0))*24)>0,(IF(((Finishtime-TIME(7,0,0))*24)<3,((Finishtime-TIME(7,0,0))*24),3)),0)),IF((ActualHRS)>3,3,ActualHRS))))),3)))),0))

starttime is the TIMEVALUE of the date/time the overtime commenced
Finishtime is the TIMEVALUE of the date/time the overtime ceased
TotalHRS is the total number of hours and minutes of the overtime
ActualHRS is determined if you need to return to work, or if are recalled as these attract a minimum time, eg 4 hrs

In addition, I also need to add a formula for Public Holidays. Between 08:00 - 17:00 is at time and half, and outside of this time is double time and half. Public Holiday is flagged in the sheet with a Y in column F. I am struggling with this one!!!

Many thanks for looking, and appreciate any assistance you can provide.

7 Replies

@dahbrown 

The only issue was that you have unable to observe that in Column T & U specially the used formula was subtracting smaller value to higher that's why returning Negative Values,, check the formula in both Column T and U and have applied the corrections, also check SAMPLE CALCULATION in column Y & Z,,, I'm sure this solves the issue.

 

If my corrections solves the issue then you may accept this as Best Answer as well Like.

Thanks Rajesh. The hours in Column S is greater than Total hours in P.
As the time of the work is before 23:00, this should be time and a half and should only appear as a value in Column S, and zero hours in Column T

I will have have a look at your corrections.

Many thanks
ZERO will appear in col T only when either of the columns returns TRUE you have tested with Y/y , dn or N/n as was in T7 also,, when Tot Hors & Time half has similar values as T8 to T15 and others,,, otherwise subtract Tot Hrs from Time half,,, I've only adjusted the formula to avoid returning negative value in col T & U by using your original formula !!

And I've a question that why you are working with TEXT data for Date Time Stamp values in col B & C ,, should be CUSTOM dd/mm/yyyy hh:mm:ss AM/PM ,, and I do believe that there is no use of getting Start and Finish time in column M & N,, you can straight forward get Actual Hours by subtracting value from Col B & C ??

Thanks. I originally had Custom date fields for start & finish times. And used HOUR(OT_Start) in Colum M & HOUR(OT_Finish) in Column N, followed by (B17="","",(C17-B17)*24) in Column O and I couldn't get the correct TIME(23,0,0)-starttime)*24) determination if the work was between 23:00 - 07:00, hence why I have TIMEVALUE(OT_Start) & TIMEVALUE(OT_Finish) in Column N & M

I am still perplexed why the logic is correct for every other time I put in except when it is any time between 20:00 and 22:00

As the rate changes to double time from 23:00 or after 3 hours of work regardless of the start time. Also depending if you return to work that is a minimum of 4 hours. This is why, I need actual hours worked and total hours as these may be different.

I am unsure how I modify the Big Calc formula in Column R to work for the hours between 20:00 - 22:00

@dahbrown 

Instead of doing this (B17="","",(C17-B17)*24) , simply use C17-B17 and on formula cell apply [H]:mm:ss cell format,, will consider the time according to 24 Hrs clock, like C17 is 17/06/2021 15:00:00 and B17 17/06/2021 11:00:00 you get 04:00:00,, as getting in Col P on the Sheet!!. And this will adjust the Time if the date changes, for example if C17 is 18/06/2021 15:00:00 you get 28:00:00.

 

And regarding the Big Calc,,, plzz check the WB I've uploaded,, and write me in which cell you are getting wrong value and what is the Expected value ,,, will help me to fix it !!

 

 

Thanks Rejesh. I have added an extra tab (sample) to show the sheet with different entries.

On the "Your recall Track" tab I have three lines. The top row shows the overtime hour incorrectly in Column S. This should have been a 1:00 and nothing in column T, it can never be a negative value (unless dates are entered incorrectly)

The 2nd row is correct as I have modified the formula in Column R (Big Calc), I changed TIME(23,0,0) to an integer close to its decimal value BUT this only seems to work for the hour between 20:00 - 21:00 - as you can see on the 3rd row.

The Big Calc formula in Column R works for every other time that has been selected.

 

(IF(((TIME(23,0,0)-starttime)*24)<=3 looks to be the culprit!

Give me some time,, soon back to you ☺