Extract Time

B

BBert

This is my time value:
19:00 - 23:00

These are my time intervals:
Time interval A: 18:00 - 22:00
Time interval B: 22:00 - 00:00

I want to check if some (or all) hours within the time value occur in
the time intervals. If yes, then give me those hours. So the result
should be:

19:00 - 22:00 (A)
22:00 - 23:00 (B)

Another example.

time value:
07:00 - 15:30

Time interval:
Time interval C: 06:00 - 08:00

Check if some (or all) hours within the time value occur in the time
interval. Yes there's one hour overlapping so the result should be:

07:00 - 08:00 (C)

Question, is there a formula or a VBA solution wich can do that?
Please let me know.

--
With Kind Regards,
BBert

April 20, 1986
Celtics (135) - Bulls (131)
Larry Bird: "God disguised as Michael Jordan"
 
K

Kevin B

Perhaps a custom VB function similar to the following example would work

Function TimeFrame(TimeValue As Date) As String

If Hour(TimeValue) = 0 Or Hour(TimeValue) >= 23 And _
Hour(TimeValue) <= 24 Then
TimeFrame = "C"
ElseIf Hour(TimeValue) >= 18 And Hour(TimeValue) < 22 Then
TimeFrame = "A"
ElseIf Hour(TimeValue) Next evaluation statement goes here
TimeFrame = "X"
End If

End Function
 
B

bert-is

Thanks Kevin
I will give that a try, but i'm afraid it's not what i'm looking for. I
want a specification of the hours.
time value: 12:00 - 20:00
time interval: 18:00 - 23:00
result should show: 18:00 - 20:00

With Kind Regards,
BBert

April 20, 1986
Celtics (135) - Bulls (131)
Larry Bird: "God disguised as Michael Jordan"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top