Question: I have a column of time data formatted like this: `hh:mm:ss`

I want to make an IF statement that returns 1, 2 or 3 corresponding to first, second or third shift if the times fall between certain values.

```
=IF(AND(E50>8,0,0,E50<16,0,0),"First",(IF(AND(E50>=16,0,0,E50<24,0,0), "Second", "Third")))

```

That's what it looks like now, but it doesn't work.

Answer: 
If you put your three shift start times in cells and reference them, it is as simple as this:

```
=IF(AND(D13>=$D$11, D13<$E$11),"First",IF(AND(D13>=$E$11,D13<$F$11),"Second", "Third"))

```

[![enter image description here](https://i.stack.imgur.com/9657p.jpg)](https://i.stack.imgur.com/9657p.jpg)
I found this to be the simplest way to convert time into 3 shifts. The plus 1 allows for excel returning midnight to 00:59 as 0. (so in the formula below, the first six results of the choose function are `"C"` referring to night shift, then at 6am the shift changes to `"A"` day shift. and so on. `"R3"` is the cell i had the time in.

```
=CHOOSE(HOUR(R3)+1, "C", "C", "C", "C","C","C", "A", "A", "A", "A", "A", "A", "A","A","B","B","B","B","B","B","B","B","C","C")

```