Excel formula to allow display number of hours in particular periods of time

Justyna82

New Member
Joined
Sep 1, 2014
Messages
19
Hi

I have almost 30,000 rows spreadsheet and i am looking to calculate how many times and when the equipment was utilised. I am looking for formula that would allow me to assign start time and end time (column A and B) to one of the 4 periods of time and they are as follow: 00:00-06:00, 06:00-12:00, 12:00-18:00 and 18:00-00:00 (column CX, CY, CZ, DA). I would like to display the number of hours that occurred in that period of time. For example if start time is 00:00 and end time is 01:00 i would like 1 hr to appear under column CX 00:00-06:00. If the start time is 05:00 and end time is 19:00 i would like to display 1 hr under column CX (00:00-06:00), 6 hrs under column CY (06:00-12:00), 6 hrs under column CZ (12:00-18:00) and 1 hr under column DA (18:00-00:00). The column C to column CT calculates if there was any use of equiment in 15 minutes intervals. The column CU simply adding how many 15 minutes intervals there was, column CV calculates minutes and column CW change them to hours, not sure how helpful that is.

I had to hide some of the columns as the spreadsheet is too large to upload image and I am unable to add XL2bb, but i hope this make sense.

I would be extremely grateful if you can help.

Thank you

1738854068820.png
 
Try:
Book1
ABCCWCXCYCZDA
1Start timeEnd time00:00-06:006:00-12:0012:00-18:0018:00-00:00
25:0019:001.006.006.001.00
30:001:001.000.000.000.00
Sheet1
Cell Formulas
RangeFormula
CX2:CX3CX2=MAX((MIN(TIME(6,0,0),$B2)-MAX(TIME(0,0,0),$A2))*24,0)
CY2:CY3CY2=MAX((MIN(TIME(12,0,0),$B2)-MAX(TIME(6,0,0),$A2))*24,0)
CZ2:CZ3CZ2=MAX((MIN(TIME(18,0,0),$B2)-MAX(TIME(12,0,0),$A2))*24,0)
DA2:DA3DA2=MAX((MIN(TIME(23,59,59),$B2)-MAX(TIME(18,0,0),$A2))*24,0)
 
Upvote 0

Forum statistics

Threads
1,226,835
Messages
6,193,236
Members
453,782
Latest member
ssg

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