View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming, microsoft.public.excel.newusers
SteveM SteveM is offline
external usenet poster
 
Posts: 133
Default Splitting up timeperiod

On Jan 8, 6:13 am, Bret Bernever wrote:
SteveMschreef:



On Jan 7, 6:04 pm, Bret Bernever wrote:
I have 4 Timeslots:
TimeSlot 1 - 6:00-8:00
TimeSlot 2 - 8:00-18:00
TimeSlot 3 - 18:00-22:00
TimeSlot 4 - 22:00-6:00


I have one time period:
TimePeriod - 17:00-1:00


Question: I want to split the time period in the appropriate timeslots
so that the results should be:


17:00-18:00 - Falls in TimeSlot 2
18:00-22:00 - Falls in Time Slot 3
22:00-1:00 - Falls in TimeSlot 4


Any ideas how to accomplish that?
I'm interested in the explicit timeintervals:
17:00-18:00
18:00-22:00
22:00-1:00
not the hours count!


Thanks in Advance
Bret Bernever


Bret,


The easiest thing would be to set up a simple VLookUp table like this:


0 4
6 1
8 2
18 3
22 4


The lookup value are the hourly slots. Set the range lookup of the
function to TRUE Use HOURS(TimePeriod) as the lookup value for each
time entry in your data set. That will associate each Time Period
with the appropriate Time Slot. Then you can do what you intend with
the info.


SteveM


Thanks Steve for cooperating on this. I think the VLookup function can
be part of the solution but can you be more specific on the example and
how to set it up. How can the function produce the end result which
looks something like this:
17:00-18:00
18:00-22:00
22:00-1:00
I really appriciate your help on this, thanks in advance
Bret


Bret it's not clear to me which is the input data. The text tells me
its what I think are specific times within each Time Period that you
want to associate to the proper Time Slot Your last email above
suggests that Time Periods are the outputs. You got me confused.

My solution addresses the problem interpreted the first way. Say you
have a column of Time Period times. Then use the Hour() and VLookUp
functions in an adjacent row with the Time Period time as the
reference value and my VLookUp table as the table source. The VLookUp
True parameter will search for the nearest Hour() value less than the
next increment and then return the Time Slot number. Say a sample
data point is 14:36 then Hour(14:36) returns 14, that value delivered
to the lookup table returns (Time Slot) 2 because the 14 is greater
than or equal to the #2 Slot minimum 8 and strictly less that the
maximum 18. You can use the real period values as strings in the
return column of the lookup table if you want. You can then use
CountIf or something on the Time Slot column just created to generate
Slot centric statistics or whatever.


SteveM