简体   繁体   中英

Excel formula not working while trying to calculate overtime or lesser time

I need to create a formula which will return overtime/lesser-time of employees based upon time duration.

I want to put the formula in column Q.

在此处输入图片说明

The requirement is such that -

  • If Total Duration(column O) is 0, then OT Hours = 0.
  • If Total Duration is >12 and Employment Type = Contractor, OT Hours = 12-O6 else O6-12.
  • If Total Duration is >8 and Employment Type <> Contractor, OT Hours = 8-O6 else O6-8.

I have entered the following formula but it is not working.

=IF(O6<>0,((IF(AND(D6<>"Contractor",O6>8),O6-8,8-O6),IF(AND(D6="Contractor",O6>12),O6-12,12-`O6))),0)`

这应该适合你:

=IF(O6=0,0,IF(D6="Contractor",IF(O6>12,O6-12,12-O6),IF(O6>8,O6-8,8-O6)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM