Formula counting staff hours

Drexl88

Board Regular
Joined
Jan 20, 2020
Messages
75
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the below formula that counts columns D - Q working out the hours an employee works based on the type of shift indicated by using "D", "N","DC", "B/D" "TWL". If an employee covers part shifts it is indicated as time (example 13:00 - 17:00). I've encountered a problem with the last part of the formula that counts the hours between time on a part shift (example, 13:00 -17:00 = 4hrs). If the employee starts the part shift one day and works past midnight (example, 20:00 - 02:00 it returns minus hours worked and reduces the overall hours.

Any help would be greatly appreciated.

=SUM(COUNTIF(D17:Q17, {"D","N","DC","B/D"}))*11.75+COUNTIF(D17:Q17,"TWL")*11.5+SUMPRODUCT(--IFERROR(RIGHT(D17:Q17,5)-LEFT(D17:Q17,5),0))*24
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

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