VBA or excel formula to work out total hours from start and finish times - please help me :(

alex9009

New Member
Joined
Oct 12, 2015
Messages
1
Hi,

im trying to create a table that will automatically work out what I need to pay my staff. We pay day rate to some people when they work between the hours of 4am and 3:59pm, and pay nights when they work 4pm - 3:59am. Some get 6am - 5:59pm and vice versa so I will need to be able to change this. So, if someone works 10am - 6pm (and they are paid days 4am-3:59pm and nights 4pm-3:59am) then they would receive 6 hours at days and 2 hours at nights. Now, to make this more complicated there is also overtime, so after 8 hours the hours would need to go into the overtime column. To give you another example a different person (who gets paid 6am-5:59pm days and 6pm-5:59am nights) works 4am until 8pm. They would receive 2 hours at nights, 6 hours at days, 4 hours at days overtime and 4 hours at nights overtime. I hope you follow.

So, what I am trying to get here is a table where I can input what hours they are paid 'days' for, what hours they are paid 'nights' for and their start and finish time and from then on excel does its thing and tells me what I need to pay.

i have been trying to figure this out for months using my basic excel skills so any help would be really appreciated. I can either do it through formulas or VBA as I have a basic knowledge of both and am equally comfortable.

Thanks for reading!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,215,155
Messages
6,123,335
Members
449,098
Latest member
thnirmitha

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