mardi 28 juin 2016

Incorrect output from a formula in Excel

I am working on a excel sheet containing time and I am trying to find it's shift timing according to time. The shift allocation is as below:

If Time >= 05:30 PM & <= 01:30 AM - 1st shift

If Time >= 01:30 AM & <= 09:30 AM - 2nd shift

If Time >= 09:30 AM & <= 01:30 AM - 3rd shift

I am using IF AND conditions but still it's showing incorrect results. Below is the formula I am using.

=IF(AND(D2>=TIMEVALUE("05:30:00 PM"),(D2<=TIMEVALUE("01:30:00 AM"))),"1",
 IF(AND(D2>=TIMEVALUE("01:30:00 AM"),(D2<=TIMEVALUE("09:30:00 AM"))),"2","3"))

enter image description here

Any idea where I am doing wrong?

Aucun commentaire:

Enregistrer un commentaire