excel中的部分

发布于 2025-02-10 05:12:16 字数 319 浏览 0 评论 0原文

我很难为此项目提出可拖动代码。

任何100或以下都很简单,我只使用= ifs(H6< e7,h6*f6) 但是我不确定该怎么办。如果我在600处将其编码为(100 *2 + 400 *4 + 100 *6)。

我正在为我应该做的事情画一个空白,任何帮助将不胜感激。

I'm having trouble coming up with a dragable code for this project.
example

Anything 100 or under is simple, I just used =IFS(H6<E7,H6*F6)
But above 100, I'm not sure what to do. If I hand coded it at 600, it would be (100 *2 + 400 *4 + 100 *6).

I'm drawing a blank on what I should do, any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

宛菡 2025-02-17 05:12:16

这里非常有趣的查找问题!我给了一些想法,并提出了应该有帮助的事情。

我水平布置括号,这样:

        0    100    500    1000
   40
  101
 1500
 6000
13000
  600

我在H列中有输入,列i为空白,括号开始于列J。

因此,首先我们查找每个存储桶的单价。很容易,普通的旧Vlookup可以做到。因此,J6有一个:

=VLOOKUP(J$5,$D$6:$F$9,3,TRUE)

在此下面,在第14行中,我已经制作了此范围的副本,这次是计算属于每个存储桶下方的单位数量。这个很有趣,可以简化,但这是我在J14中的内容:

=MAX(0,MIN(MAX(0,$H14-J$5),VLOOKUP(J$5,$D$6:$E$9,2,FALSE)-SUM($I14:I14)))

然后我在下面制作了另一个副本,以乘以两张桌子,所以我在J22中使用了这一点:

=J14*J6

通过完成下面的金额的总和每个支架,我们都会得到我们要寻找的东西:

  • 40 =&gt; 80 $
  • 101 =&gt; 204 $
  • 1500 =&gt; 9800 $
  • 6000 =&gt; 54800 $
  • 13000 =&gt; 124800 $
  • 600 =&gt; 2400 $

SO SO,肯定可以清除助手范围,但随后它变成了一个怪物配方,很难调整和/或稍后调试 - 最好的解决方案是这样做还是保持助手范围(也许移动或隐藏)取决于您!

略有编辑,要进行查找工作,您要么需要一个顶部支架,要么将9999999的上限作为“ 1000+”支架的上限。

Very interesting lookup problem here! I've given it a few thoughts and came up with something that should help.

I've laid out the brackets horizontally, like this:

        0    100    500    1000
   40
  101
 1500
 6000
13000
  600

I have the inputs in column H, column I is left blank, and the brackets begin in column J.

So first we lookup the unit price per bucket. Easy enough, a plain old VLOOKUP will do. So J6 has this:

=VLOOKUP(J$5,$D$6:$F$9,3,TRUE)

Underneath this, in row 14, I've made a copy of this range, this time to calculate the number of units that belong under each bucket. This one was fun to come up with and could probably be simplified, but here's what I have in J14:

=MAX(0,MIN(MAX(0,$H14-J$5),VLOOKUP(J$5,$D$6:$E$9,2,FALSE)-SUM($I14:I14)))

Then I made another copy underneath to just multiply the two tables, so I have this in J22:

=J14*J6

By making the sum of the amounts under each bracket, we get what we're looking for:

  • 40 => 80$
  • 101 => 204$
  • 1500 => 9800$
  • 6000 => 54800$
  • 13000 => 124800$
  • 600 => 2400$

So, with a little bit of clean-up the helper ranges can certainly be removed, but then it becomes a monster formula that's pretty hard to tweak and/or debug later - whether the best solution is to do that or keep the helper ranges (and move or hide them, perhaps), is up to you!

Slight little edit, for the lookups to work you either need one more top bracket, or to have something like 9999999 as the upper bound for the "1000+" bracket.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文