Sorting time range between customized periods

oreng

New Member
Joined
Mar 2, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi there, I need your support in developing formula that can sort hours by pre set periods of the day as follows (now done manually) :
Thanks
1709423491203.png
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
In D2 copied to full range.
Excel Formula:
=MEDIAN(INDEX($L$1:$L$4,MATCH(D$1,$J$1:$J$4,0)),INDEX($K$1:$K$4,MATCH(D$1,$J$1:$J$4,0)),$B2+IF($B2<$A2,1,0))-MEDIAN(INDEX($L$1:$L$4,MATCH(D$1,$J$1:$J$4,0)),INDEX($K$1:$K$4,MATCH(D$1,$J$1:$J$4,0)),$A2)

startenddurationpeak-AMPeak-PMOff peakNightpeak-AM
06:00​
10:00​
08:00​
22:00​
14:00​
02:00​
04:00​
05:00​
03:00​
Off peak
10:00​
15:00​
08:00​
10:00​
02:00​
02:00​
00:00​
00:00​
00:00​
Peak-PM
15:00​
19:00​
Night
19:00​
30:00​
 
Upvote 0
Solution

Forum statistics

Threads
1,215,140
Messages
6,123,270
Members
449,093
Latest member
Vincent Khandagale

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