简体   繁体   English

用excel写一个复杂的公式来计算加班时间

[英]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.我想在excel中编写一个公式来获得某个输出,但我不能。

The situation is that:情况是:

We have workers working in a site, performing 2 operations= A and B.我们有工人在一个站点工作,执行 2 个操作 = A 和 B。

We want to pay the workers for overtime hours resulting for operation B only.我们只想向工人支付因操作 B 导致的加班时间。

So, this overtime exists when one of two situations happen:因此,当发生以下两种情况之一时,就会出现这种加班:

  • Time for operation B exceeds 8 hours.操作 B 的时间超过 8 小时。 or或者
  • Total time for operation A and b exceeds 8 hours.操作 A 和 b 的总时间超过 8 小时。

So, to check if there is an overtime, we should sum hours of operation A and B, (so they are linked).因此,要检查是否有加班,我们应该将操作 A 和 B 的时间相加(因此它们是相关联的)。

But after that, we want to exclude the operation A hours, and pay for the amount for B only.但在那之后,我们想排除操作 A 小时,而只为 B 支付金额。

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).假设A1为操作A小时值,A2为操作B小时值,B1为结果(加班时间)。 In B1 put :在 B1 中:

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

Hope that helps.希望有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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