Matching a time stamp to a shift and identifying the crew....

caytib

New Member
Joined
Jun 25, 2002
Messages
25
So, I have two spreadsheets. One has a list of data with a time and date stamp on it. The other has the crew shift schedule on it.

Spreadsheet 1

A B C D
1/1/11 8:00 PM 42 637 11222
1/1/11 11:00 PM 66 499 10978
1/3/11 5:00 AM 27 529 10223
1/3/11 7:00 AM 56 588 11017

These time stamps are from any hour of the day.




Spreadsheet 2

A B C D E F
TIME SHIFT STARTS CREW1 CREW2 CREW3 CREW4 CREW5
1/1/11 06:00 AM D O O N S
1/2/11 06:00 AM D O O N S
1/3/11 06:00 AM O N D S O

(D = Day, N= Night, O = Off, S= Staff Day)

I want to go through the timestamp data and figure out which crew was working. So if I look at line 1 and it is 1/1/11 8:00 PM, the macro or formula can go look at spreadsheet 2, find out that that occurs during 1/1/11 6:00 AM shifts, and that it is Crew D. Once it finds the row with the right crew, I'll copy the 5 cells with the crew info over to spreadsheet one, but I need help with getting it to find the right row. Is this possible?


Any help is appreciated.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
If your data is sorted in date order and formatted as numeric values as a date (not text), then you can use the VLOOKUP formula. In the example below, the date from the first sheet is looked up in the second sheet and it pulls the corresponding data into sheet 1.

As I stated, the dates in sheet 2 have to be sorted in ascending order or it will return incorrect data. The VLOOKUP formula looks down the date list until it finds a value larger and then returns the the value on the last row before going over. This is why the dates in the 2nd sheet have to be sorted. (The dates in the first sheet can be in any order.)

Hope this helps.


Excel 2002
ABCDEFGHI
1ABCDCREW1CREW2CREW3CREW4CREW5
201/01/2011 08:00 PM4263711222DOONS
301/01/2011 11:00 PM6649910978DOONS
401/03/2011 05:00 AM2752910223DOONS
501/03/2011 07:00 AM5658811017ONDSO
6
7
8
9
10TIME SHIFT STARTSCREW1CREW2CREW3CREW4CREW5
1101/01/2011 06:00 AMDOONS
1201/02/2011 06:00 AMDOONS
1301/03/2011 06:00 AMONDSO
Sheet1
Cell Formulas
RangeFormula
E2=VLOOKUP($A2,$A$11:$F$13,2)
E3=VLOOKUP($A3,$A$11:$F$13,2)
E4=VLOOKUP($A4,$A$11:$F$13,2)
E5=VLOOKUP($A5,$A$11:$F$13,2)
F2=VLOOKUP($A2,$A$11:$F$13,3)
F3=VLOOKUP($A3,$A$11:$F$13,3)
F4=VLOOKUP($A4,$A$11:$F$13,3)
F5=VLOOKUP($A5,$A$11:$F$13,3)
G2=VLOOKUP($A2,$A$11:$F$13,4)
G3=VLOOKUP($A3,$A$11:$F$13,4)
G4=VLOOKUP($A4,$A$11:$F$13,4)
G5=VLOOKUP($A5,$A$11:$F$13,4)
H2=VLOOKUP($A2,$A$11:$F$13,5)
H3=VLOOKUP($A3,$A$11:$F$13,5)
H4=VLOOKUP($A4,$A$11:$F$13,5)
H5=VLOOKUP($A5,$A$11:$F$13,5)
I2=VLOOKUP($A2,$A$11:$F$13,6)
I3=VLOOKUP($A3,$A$11:$F$13,6)
I4=VLOOKUP($A4,$A$11:$F$13,6)
I5=VLOOKUP($A5,$A$11:$F$13,6)
 
Last edited:
Upvote 0
You are stinking brilliant! And that is so much easier than the way I was trying to do this. (I have never been good at KISS (Keep It Simple Stupid), I prefer the 'try to do it the hardest way humanly possible until you are banging your head on your desk' method :eek:P ).

And it's probably more proof that Excel has evolved faster than I have and it's time to go take an Excel class.

Thank you so much!
 
Upvote 0
You are stinking brilliant! And that is so much easier than the way I was trying to do this. (I have never been good at KISS (Keep It Simple Stupid), I prefer the 'try to do it the hardest way humanly possible until you are banging your head on your desk' method :eek:P ).

And it's probably more proof that Excel has evolved faster than I have and it's time to go take an Excel class.

Thank you so much!

I'm glad this solution worked for you.

As far as being stinking brilliant.... Well I probably qualify for being stinky from time to time, but NEVER brilliant. :LOL: But, if you hang out on this web site, you will find many that ARE brilliant. I wish I was 1/10th as smart as some of these folks.

You can probably skip the Excel classes and just go to YouTube and search for Bill Jelan's Excel videos. This guy makes it look so easy. I wish I could just remember the stuff I learn when it comes time to use it.

Good luck!
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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