简体   繁体   中英

Writing a complex formula in excel to calculate overtime hours

I want to write a formula in excel to obtain a certain output, but I couldn't.

The situation is that:

We have workers working in a site, performing 2 operations= A and B.

We want to pay the workers for overtime hours resulting for operation B only.

So, this overtime exists when one of two situations happen:

  • Time for operation B exceeds 8 hours. or
  • Total time for operation A and b exceeds 8 hours.

So, to check if there is an overtime, we should sum hours of operation A and B, (so they are linked).

But after that, we want to exclude the operation A hours, and pay for the amount for B only.

So, they are linked necessary, but we want to un-link them at second step.

How can we do this?

Assuming A1 is the value of operation A hours, A2 is the value of operation B hours, and B1 is the result (overtime hours). In B1 put :

 =if(OR(A2>8,(A1+A2)>8)),A2,"No overtime")

Hope that helps.

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