Home

Overtime Calculation with Multiple Work Rates

%3CLINGO-SUB%20id%3D%22lingo-sub-226775%22%20slang%3D%22en-US%22%3EOvertime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-226775%22%20slang%3D%22en-US%22%3E%3CP%3EI%20need%20a%20formula%20that%20will%20accomplish%20the%20following%2C%20and%20I%20am%20not%20sure%20how%20to%20create%20it.%3C%2FP%3E%3CP%3EWe%20have%20employees%20who%20have%202%20different%20rates%2C%20one%20for%20Work%20and%20one%20for%20Drive.%26nbsp%3B%20Our%20payroll%20spreadsheet%20has%20each%20day%20of%20the%20week%20broken%20into%20work%20and%20drive%20hours.%26nbsp%3B%20We%20need%20a%20formula%20that%20will%20take%20the%20summed%20total%20for%20work%20and%20drive%20hours%2C%20apply%20the%20first%2040%20total%20hours%20to%20their%20respective%20column%2C%20and%20add%20the%20remaining%20work%20and%20drive%20hours%20to%20the%20work%20and%20drive%20overtime%20columns.%26nbsp%3B%20I%20have%20figured%20out%20how%20to%20create%20a%20formula%20that%20will%20put%20the%20first%2040%20hours%20into%20Work%20and%20the%20remaining%20hours%20into%20Work-OT%2C%20but%20cannot%20determine%20how%20to%20accomplish%20this%20considering%20both%20rates%2C%20ie.%20if%20the%20employee%20hits%2040%20hours%20half%20way%20through%20their%20drive%20on%20Friday%2C%20the%20remaining%20drive%20hours%20as%20well%20as%20drive%20hours%20from%20Sat%20%2B%20Sun%20are%20put%20to%20the%20Drive-OT%20column%2C%20and%20the%20remaining%20work%20hours%20for%20Sat%20%2B%20Sun%20are%20put%20to%20Work-OT.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-226775%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOvertime%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPayroll%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWork%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-229541%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-229541%22%20slang%3D%22en-US%22%3E%3CP%3ESuper.%20Glad%20it%20worked%20out.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-229539%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-229539%22%20slang%3D%22en-US%22%3E%3CP%3EI%20applied%20the%20changed%20code%20to%20my%20google%20sheet%20document%20and%20with%20a%20few%20adjustments%20it%20seems%20to%20be%20working%20perfectly!%26nbsp%3B%20Thank%20you%20so%20much%2C%20I%20really%20appreciate%20your%20help%2C%20this%20functionality%20will%20streamline%20our%20payroll%20process%20significantly.%26nbsp%3B%20Much%20thanks%20again!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-229077%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-229077%22%20slang%3D%22en-US%22%3E%3CP%3Ewell%20now.%20I%20just%20tried%20uploading%20it%20to%20docs%20and%20your%20right%20its%20all%20gone%20wrong.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELooking%20at%20it%2C%20it%20has%20to%20do%20with%20how%20excel%20and%20docs%20seem%20to%20handle%20empty%20cells.%20in%20the%20overtime%20calculation%20excel%20is%20putting%20a%200%20in%20cells%20and%20docs%20is%20not.%20That%20means%20that%20other%20parts%20of%20the%20formula%20that%20were%20checking%20if%20the%20cell%20is%20empty%20or%20not%20weren't%20working.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20added%20a%20bit%20of%20a%20fix..%20i%20dont%20really%20use%20docs%20so%20there%20might%20be%20a%20'proper'%20way%20to%20adapt%20the%20formula%2C%20but%20i've%20added%20a%20max(0%2CA3)%20to%20my%20formula%20which%20kinda%20mimics%20excel%20and%20fixes%20it%20(i%20think).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20quite%20enjoyed%20this%20puzzle.%20(assuming%20this%20fixes%20your%20problem%20%3AD)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-229064%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-229064%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20fixed%20everything.%26nbsp%3B%20It%20seems%20to%20be%20working%20perfectly%20thank%20you%20so%20much.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20to%20upload%20it%20to%20Google%20Sheets%20but%20when%20I%20do%20so%20it%20doesn't%20calculate%20correctly.%26nbsp%3B%20I%20was%20thinking%20it%20has%20something%20to%20do%20with%20the%20code%20in%20the%20Helpers%20sheet.%26nbsp%3B%20I%20am%20not%20sure%20if%20there%20is%20a%20difference%20in%20functions%20between%20Excel%20and%20Google%20Sheets%2C%20but%20it%20seems%20that%20the%20only%20ones%20used%20are%20IF%20and%20SUM%20which%20I%20know%20work%20the%20same%20in%20both.%26nbsp%3B%20Perhaps%20it%20is%20something%20more%20simple%2C%20like%20a%20difference%20in%20how%20the%20code%20is%20laid%20out%20(does%20%22%22%20need%20to%20be%20written%20differently%20in%20sheets%3F)%20but%20I%20am%20not%20sure.%26nbsp%3B%20If%20sheets%20is%20not%20something%20you%20have%20experience%20with%20I%20can%20look%20elsewhere%2C%20you%20have%20been%20so%20generous%20already.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-228322%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-228322%22%20slang%3D%22en-US%22%3E%3CP%3EI%20think%20i've%20spotted%20the%20mistake.%20Have%20a%20look%20at%20the%20attached.%20The%20only%20change%20i've%20made%20is%20removing%20what%20seems%20to%20be%20an%20unnecessarily%20complicated%20calculation%20in%20the%20first%20column%20of%20the%20total%20time%20section.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20now%20matching%20what%20you%20manually%20calculated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-228180%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-228180%22%20slang%3D%22en-US%22%3E%3CP%3EI%20can't%20express%20how%20helpful%20this%20was!%26nbsp%3B%20Thank%20you%20so%20much.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3EI%20see%20that%20the%20sheet%20is%20working%20properly%20with%20the%20numbers%20you%20had%20input%2C%20but%20when%20I%20try%20to%20insert%20an%20employee's%20actual%20hours%20for%20the%20week%2C%20the%20hours%20broken%20into%20W%2FD%2FOT%20don't%20agree%20with%20what%20I%20get%20when%20I%20do%20it%20manually%2C%20so%20I%20am%20not%20sure%20if%20I%20am%20inputting%20incorrectly%20or%20if%20I%20need%20to%20change%20something%20about%20the%20sheet.%20For%20example%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20hours%20you%20input%20total%20to%2046W%2014D.%26nbsp%3B%20The%20sheet%20breaks%20them%20correctly%20into%2031%2F9%2F15%2F5%2C%20but%20the%20last%20line%20(A12%3AAB12)%20shows%20the%20breakdown%20as%2031%2F8%2F15%2F5.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20put%20in%20the%20hours%20Ive%20attached%20in%20the%20screenshot%2C%20the%20totals%20are%2047W%2017.5D%20which%20I%20manually%20translated%20into%2028%2F12%2F19%2F5.5%2C%20but%20the%20worksheet%20shows%20it%20as%2028%2F9%2F19%2F5.5.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20to%20diagnose%20why%20it%20seems%20to%20be%20miscalculating%20the%20regular%20Drive%20time%2C%20as%20the%20W%2BD%20must%20add%20to%2040.%26nbsp%3B%20The%20only%20thing%20that%20I%20found%2C%20was%20that%20even%20if%20I%20delete%20all%20of%20the%20data%20on%20line%203%2C%20it%20still%20puts%20one%20hour%20to%20Drive%20time%20even%20though%20no%20hours%20are%20filled%20in%20at%20all.%26nbsp%3B%20Not%20sure%20if%20this%20is%20the%20source%20of%20the%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20you%20have%20any%20insights.%26nbsp%3B%20Thanks%20so%20much%20for%20everything%20youve%20done%20already.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-227818%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227818%22%20slang%3D%22en-US%22%3E%3CP%3EI%20think%20i've%20done%20it.%3C%2FP%3E%3CP%3EI'm%20attaching%20a%20workbook%20that%20follows%20the%20screenshot%2C%20so%20i'm%20hoping%20you%20can%20copy%2Fpaste%20your%20data%20and%20it%20will%20just%20work%20for%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20explain%20though.%20It%20has%203%20worksheets.%20The%20first%20(Example)%20is%20basically%20the%20sheet%20I%20used%20to%20try%20and%20work%20it%20out.%20I%20think%20it%20might%20be%20easier%20to%20understand%20what%20is%20happening%20on%20that%20sheet%2C%20but%20it's%20not%20usable.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20one%20called%20Data%2C%20is%20where%20you%20should%20update%20your%20records%2C%20and%20the%20last%20one%20(helpers)%20is%20where%20the%20calculations%20are%20happening.%20You%20need%20to%20make%20sure%20that%20there%20is%20a%20row%20of%20'helpers'%20for%20every%20row%20in%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20test%20it%2C%20I've%20been%20looking%20at%20it%20long%20enough%20that%20i'm%20not%20100%25%20i%20can%20see%20it%20properly%20now%20%3AD%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-227412%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227412%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F39513iE924CE9B1E05FF75%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202018-08-12%20at%2011.50.13%20AM.png%22%20title%3D%22Screen%20Shot%202018-08-12%20at%2011.50.13%20AM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20a%20sample%20of%20how%20the%20sheet%20is%20set%20up.%26nbsp%3B%20Ideally%20it%20would%20work%20so%20that%20Work%20(W)%20and%20Drive%20(D)%20hours%20columns%20are%20added%20to%20their%20respective%20columns%20on%20the%20right%2C%20until%20W%2BD%20combine%20for%2040%20hours%2C%20and%20then%20each%20hour%20after%20that%20would%20go%20into%20W%2FOT%20if%20W%20hours%20and%20D%2FOT%20if%20D%20hours.%26nbsp%3B%20I%20can%20provide%20cell%20numbers%20if%20needed.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-227374%22%20slang%3D%22en-US%22%3ERe%3A%20Overtime%20Calculation%20with%20Multiple%20Work%20Rates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227374%22%20slang%3D%22en-US%22%3E%3CP%3EDo%20you%20have%20an%20example%20of%20how%20your%20data%20is%20laid%20out%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
ryder.simmonscovering
Occasional Contributor

I need a formula that will accomplish the following, and I am not sure how to create it.

We have employees who have 2 different rates, one for Work and one for Drive.  Our payroll spreadsheet has each day of the week broken into work and drive hours.  We need a formula that will take the summed total for work and drive hours, apply the first 40 total hours to their respective column, and add the remaining work and drive hours to the work and drive overtime columns.  I have figured out how to create a formula that will put the first 40 hours into Work and the remaining hours into Work-OT, but cannot determine how to accomplish this considering both rates, ie. if the employee hits 40 hours half way through their drive on Friday, the remaining drive hours as well as drive hours from Sat + Sun are put to the Drive-OT column, and the remaining work hours for Sat + Sun are put to Work-OT. 

9 Replies
Highlighted

Do you have an example of how your data is laid out?

Highlighted

Screen Shot 2018-08-12 at 11.50.13 AM.png

 

This is a sample of how the sheet is set up.  Ideally it would work so that Work (W) and Drive (D) hours columns are added to their respective columns on the right, until W+D combine for 40 hours, and then each hour after that would go into W/OT if W hours and D/OT if D hours.  I can provide cell numbers if needed.

Highlighted

I think i've done it.

I'm attaching a workbook that follows the screenshot, so i'm hoping you can copy/paste your data and it will just work for you.

 

To explain though. It has 3 worksheets. The first (Example) is basically the sheet I used to try and work it out. I think it might be easier to understand what is happening on that sheet, but it's not usable.

 

The one called Data, is where you should update your records, and the last one (helpers) is where the calculations are happening. You need to make sure that there is a row of 'helpers' for every row in data.

 

Do test it, I've been looking at it long enough that i'm not 100% i can see it properly now :D

Highlighted

I can't express how helpful this was!  Thank you so much.  

I see that the sheet is working properly with the numbers you had input, but when I try to insert an employee's actual hours for the week, the hours broken into W/D/OT don't agree with what I get when I do it manually, so I am not sure if I am inputting incorrectly or if I need to change something about the sheet. For example:

 

The hours you input total to 46W 14D.  The sheet breaks them correctly into 31/9/15/5, but the last line (A12:AB12) shows the breakdown as 31/8/15/5.

 

When I put in the hours Ive attached in the screenshot, the totals are 47W 17.5D which I manually translated into 28/12/19/5.5, but the worksheet shows it as 28/9/19/5.5.

 

I have tried to diagnose why it seems to be miscalculating the regular Drive time, as the W+D must add to 40.  The only thing that I found, was that even if I delete all of the data on line 3, it still puts one hour to Drive time even though no hours are filled in at all.  Not sure if this is the source of the issue.

 

Please let me know if you have any insights.  Thanks so much for everything youve done already.

 

 

 

 

 

 

 

Highlighted

I think i've spotted the mistake. Have a look at the attached. The only change i've made is removing what seems to be an unnecessarily complicated calculation in the first column of the total time section.

 

It's now matching what you manually calculated.

Highlighted

Hello,

 

That fixed everything.  It seems to be working perfectly thank you so much.  

I have tried to upload it to Google Sheets but when I do so it doesn't calculate correctly.  I was thinking it has something to do with the code in the Helpers sheet.  I am not sure if there is a difference in functions between Excel and Google Sheets, but it seems that the only ones used are IF and SUM which I know work the same in both.  Perhaps it is something more simple, like a difference in how the code is laid out (does "" need to be written differently in sheets?) but I am not sure.  If sheets is not something you have experience with I can look elsewhere, you have been so generous already.

Highlighted

well now. I just tried uploading it to docs and your right its all gone wrong.

 

Looking at it, it has to do with how excel and docs seem to handle empty cells. in the overtime calculation excel is putting a 0 in cells and docs is not. That means that other parts of the formula that were checking if the cell is empty or not weren't working.

 

I've added a bit of a fix.. i dont really use docs so there might be a 'proper' way to adapt the formula, but i've added a max(0,A3) to my formula which kinda mimics excel and fixes it (i think).

 

I've quite enjoyed this puzzle. (assuming this fixes your problem :D)

Highlighted

I applied the changed code to my google sheet document and with a few adjustments it seems to be working perfectly!  Thank you so much, I really appreciate your help, this functionality will streamline our payroll process significantly.  Much thanks again!

Highlighted

Super. Glad it worked out.