Vlookup using TIMEVALUE

Bugas

New Member
Joined
Sep 17, 2012
Messages
44
Office Version
  1. 2007
Platform
  1. Windows
I'm trying to identify which employees work at day, at night or during circadian time. Without using VBA is there any formula in excel to this?


In this example I have the result I want to get at Identification (Column D).


The conditions are above (A17). The most important is:


1 circadian (02:00 - 06:00)
2 night (23:00 - 06:29)
3 day (6:30 - 22:59).


By definition circadian is part of the night, so it seems a duplicate issue but it is not. Other important issue is that by touching only one minute of the most important, you'll get the Identification. For example - Start working at 6:00 is considered circadian. Start working at 6:29 is considered night. Stop working at 23:00 is considered night. Stop working at 02:00 is considered circadian.


Kalvin, Lenny & Mark are Circadian and not Night because they work between 02:00 and 06:00 (included)


Is there a way for you to help me?

I already have a formula for D2, that is all OK. However in D16 I get Day and should be Circadian.


Thanks :)




ABCD
1Employee nameStart TimeEnd TimeIdentification
2Alan04:0006:00Circadian
3Bruce05:0009:00Circadian
4Charlie06:0008:00Circadian
5Danny06:2013:20Night
6Ethan06:2915:00Night
7Freddie06:3015:00Day
8Gene08:0016:00Day
9Hans17:0022:59Day
10Irvin20:0023:00Night
11Jack21:0001:59Night
12Kalvin23:0002:00Circadian
13Lenny23:3007:00Circadian
14Mark01:0009:00Circadian
15Norman01:0001:59Night
16Oscar21:1002:35Circadian
17Definitions
18Circadian02:0006:00
19Night23:0001:59
20Night06:0106:29
21Day06:3022:59

<tbody>
</tbody>


D2
=IF(OR(B2=$B$18,B2=$C$18,C2=$B$18,C2=$C$18,AND(B2<$C$18,B2>$B$18),AND(B2<$B$18,C2>$C$18),AND(B2>C2,AND(B2>$B$18,C2>$C$18))),$A$18,IF(OR(B2=$B$19,B2=$C$19,C2=$B$19,C2=$C$19),$A$19,IF(OR(B2=$B$20,B2=$C$20,C2=$B$20,C2=$C$20),$A$20,IF(OR(B 2=$B$21,B2=$C$21,C2=$B$21,C2=$C$21),$A$21,IF(OR(AND(B2<$C$19,B2>$B$19),AND(B2>C2,AND(B2>$B$19,C2>$C$19))),$A$19,IF(OR(AND(B2<$C$20,B2>$B$20)),$A$20,IF(OR(AND(B2<$C$21,B2>$B$21)),$A$21,"")))))))
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
is this correct

start table
00:00night
00:30night
01:00night
01:30night
02:00circ
02:30circ
03:00circ
03:30circ
04:00circ
04:30circ
05:00circ
05:30circ
06:00circ
06:30day
07:00day
07:30day
08:00day
08:30day
09:00day
09:30day
10:00day
10:30day
11:00day
11:30day
12:00day
12:30day
13:00day
13:30day
14:00day
14:30day
15:00day
15:30day
16:00day
16:30day
17:00day
17:30day
18:00day
18:30day
19:00day
19:30day
20:00day
20:30day
21:00day
21:30day
22:00day
22:30day
22:59day
23:30night
23:59night

<colgroup><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Yes it is ok

is this correct

start table
00:00night
00:30night
01:00night
01:30night
02:00circ
02:30circ
03:00circ
03:30circ
04:00circ
04:30circ
05:00circ
05:30circ
06:00circ
06:30day
07:00day
07:30day
08:00day
08:30day
09:00day
09:30day
10:00day
10:30day
11:00day
11:30day
12:00day
12:30day
13:00day
13:30day
14:00day
14:30day
15:00day
15:30day
16:00day
16:30day
17:00day
17:30day
18:00day
18:30day
19:00day
19:30day
20:00day
20:30day
21:00day
21:30day
22:00day
22:30day
22:59day
23:30night
23:59night

<tbody>
</tbody>
 
Upvote 0
then just use a lookup table for start time and a similar table for end time - if this is necessary
 
Upvote 0
you need to think about your definitions - if work started at 7 pm and finished at 7 am would it all be CIRC ?

if work started at 03:00 and finished at 3pm would it all be CIRC

I am thinking of a matrix 0 to 24 down the side for start times and 0 to 24 along the top for finish times then populate each intersection with your definitions
 
Upvote 0
you need to think about your definitions - if work started at 7 pm and finished at 7 am would it all be CIRC ?

if work started at 03:00 and finished at 3pm would it all be CIRC

I am thinking of a matrix 0 to 24 down the side for start times and 0 to 24 along the top for finish times then populate each intersection with your definitions

if work started at 7 pm and finished at 7 am would it all be CIRC - Yes
if work started at 03:00 and finished at 3pm would it all be CIRC - Yes

 
Upvote 0
so a single lookup table but lookup both start and finish times - if EITHER is between 02:00 and 06:00 then circ - if circ not returned use another lookup table for the other categories
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,244
Members
448,879
Latest member
VanGirl

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