I cannot figure out what is the problem in my formula. I am only getting correct answer if all the hours is equal to 1.
My formula
=IF(AND(B12<$O$17, C12>=$O$16), $O$21, IF(AND(B12<$O$17, AND(C12>=$O$17, C12<=$O$13)), C12-$O$17, IF(AND(B12<$O$17, AND(C12>$O$13, C12<$O$14)), $O$20, IF(AND(B12<$O$17, C12<= $O$17 ),$O$22, IF(AND(B12<$O$17, AND(C12>=$O$13, C12<=$O$16)), (C12 - $O$17)-$O$19, IF(AND(AND(B12>=$O$17, B12<=$O$13), AND(C12>=$O$17, C12<=$O$13)), C12-B12, IF(AND(AND(B12>=$O$17, B12<=$O$13),AND(C12>$O$13, C12<$O$18)), $O$13-B12, IF(AND(AND(B12>=$O$17, B12<=$O$13),AND(C12>=$O$18, C12<=$O$16)), (C12-B12)-$O$19, IF(AND(AND(B12>=$O$17, B12<=$O$13), C12>$O$16), ($O$16-B12)-$O$19, IF(AND(AND(B12>$O$13, B12<$O$18), AND(C12>=$O$18, C12<=$O$16)), C12-$O$18, IF(AND(AND(B12>$O$13, B12<$O$18), AND(C12>$O$13, C12<$O$18)), $O$22, IF(AND(AND(B12>=$O$18, B12<=$O$16), AND(C12>=$O$18, C12<=$O$16)), C12-B12, IF(AND(AND(B12>$O$13, B12<$O$14), C12>$O$16), $O$20, $O$16-B12)))))))))))))
Bookmarks