
Originally Posted by
nicolelschramartin
I am terrible at putting together if(and) functions. Can someone look at the below function and tell me where the mistakes are?
=IF(D27<TIME(9,45,0),D27+TIME(0,B16,0),IF(AND((D27)>=TIME(9,45,0),D27<TIME(11,50,0)),D27+TIME(0,B14,0),IF(AND((D27)>=TIME(11,50,0),D27<=TIME(13,0,0)),D27+TIME(1,0,0),IF(AND(D27)>TIME(13,0,0),D27<=TIME(1
4,15,0)),D27+TIME(0,B13,0),IF(D27>TIME(14,15,0),TIME(14,30,0),"ERROR")))))
.....
There is no need to use AND() with each IF()
The formula will be read and evaluated at the first TRUE value in this order
<09:45:00
<11:50:00
<13:00:00
<14:15:00
Try this
Formula:
=IF(D27<TIME(9,45,0),D27+TIME(0,B16,0),IF(D27<TIME(11,50,0),D27+TIME(0,B14,0),IF(D27<=TIME(13,0,0),D27+TIME(1,0,0),IF(D27<=TIME(14,15,0),D27+TIME(0,B13,0),IF(D27>TIME(14,15,0),TIME(14,30,0),"ERROR")))))
Or, I suspect this will possibly do as you need
Formula:
=IF(D27<TIME(9,45,0),D27+TIME(0,B16,0),IF(D27<TIME(11,50,0),D27+TIME(0,B14,0),IF(D27<=TIME(13,0,0),D27+TIME(1,0,0),IF(D27<=TIME(14,15,0),D27+TIME(0,B13,0),TIME(14,30,0)))))
Bookmarks