Calculating times

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,359
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to make a spreadsheet that calculates wages between a start time and the end of the day, so 12am. There is a set wage cost/hr from 6am - 6pm and another wage cost/hr from 6pm - 6am.

  • The start time is in H19
  • The cost/hr for 6am - 6pm is in I41
  • The cost/hr for 6pm - 6am is in I42
Can someone help me please with a formula that will calculate the wage cost for the portion of the day?
 

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.
Here is a way using a lookup table.

Book1
ABCDEF
1Start TimeEnd TimeTotalTimeValue
23:00 PM8:00 PM$75.00 12:00 AM15
31:00 AM15
42:00 AM15
53:00 AM15
64:00 AM15
75:00 AM15
86:00 AM10
97:00 AM10
108:00 AM10
119:00 AM10
1210:00 AM10
1311:00 AM10
1412:00 PM10
151:00 PM10
162:00 PM10
173:00 PM10
184:00 PM10
195:00 PM10
206:00 PM15
217:00 PM15
228:00 PM15
239:00 PM15
2410:00 PM15
2511:00 PM15
Sheet5
Cell Formulas
RangeFormula
C2C2=SUMPRODUCT(LOOKUP((ROW(INDIRECT(HOUR(A2) & ":" & HOUR(B2)))*(1/24)),$E$2:$E$25,$F$2:$F$25))
E3:E25E3=E2+(1/24)
 
Upvote 0
Thanks for that, what if the start time is not exactly at the hour, but say 15:15:00?
 
Upvote 0
I tried the formula and it gave me a #REF error, this is what I had,
=SUMPRODUCT(LOOKUP((ROW(INDIRECT(HOUR(H46) & ":" & HOUR(H47)))*(1/24)),$H$51:$H$74,$I$51:$I$74))

  • Start time is in H46
  • End time is in H47 (seeing as though I want to find the wage cost for that portion of the day from the start time till 12am, I made the value in H47 0:00:00)
  • The times are in H51 to H74
  • The relevant hourly wages are in I51 to I74
 
Upvote 0

Forum statistics

Threads
1,222,905
Messages
6,168,948
Members
452,227
Latest member
sam1121

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