如何将小计和sumif与一系列标准相结合 [英] How to combine subtotal and sumif with a range of criteria

查看:205
本文介绍了如何将小计和sumif与一系列标准相结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



SUMIF 语句:

  = SUMPRODUCT(SUMIF E:E,O2:O21,G:G))

我在哪里做 SUMIF 小计:

  = SUMPRODUCT(SUBTOTAL(9,OFFSET G2,ROW(G2:G5000)-ROW(G2),0)),(E2:E5000 = O2:O21)+0)

最后一个语句返回一个#N / A 错误。



谢谢。



示例:

 订单|日期|马赫| Rem 
------- | ------- | ------- | -------
A | 01/20 | 01 | 1200
B | 01/11 | 02 | 400
C | 01/21 | 01 | 420
D | 01/28 | 04 | 1180
E | 01/20 | 01 | 1200
F | 01/11 | 04 | 400
G | 01/21 | 03 | 420
H | 01/28 | 04 | 1180

不,我确定我的桌子正确,所以这里是我看到的图像。 p>



我要做的是基于过滤器在日期 - 例如,在1/21之前发生的所有订单 - 然后给出机器列表中剩余的数量。



所以,如果我想要总计机器1和4,该表的输出(日期过滤器打开)将为2800,求和顺序A,D,E和F.滤镜关闭时为5580。

解决方案

尝试这个公式:

  = SUMPRODUCT(NOT ISERROR(MATCH($ C:$ C; Y:焦耳; 0)))* SUBTOTAL(103; OFFSET(C1; ROW(C:C)-MIN(ROW(C:C)); 0)); $ D :$ D)

Excel结构:



应用过滤器后:



您还可以在公式中包含日期标准:



$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ D:$ D)

其中L1是日期标准。



但是,当然,如果您需要过滤器使用,请使用第一个解决方案。


I'm trying to create a formula to combine a SUMIF (using a range of criteria) and a subtotal.

The SUMIF statement:

=SUMPRODUCT(SUMIF(E:E,O2:O21,G:G))

And where I've gotten on making that SUMIF subtotal:

=SUMPRODUCT(SUBTOTAL(9,OFFSET(G2,ROW(G2:G5000)-ROW(G2),0)),(E2:E5000=O2:O21)+0)

That last statement returns an #N/A error. I'd appreciate any input y'all can provide.

Thank you.

Example:

Order  | Date  | Mach  | Rem 
-------|-------|-------|-------
A      |01/20  | 01    | 1200
B      |01/11  | 02    | 400
C      |01/21  | 01    | 420
D      |01/28  | 04    | 1180
E      |01/20  | 01    | 1200
F      |01/11  | 04    | 400
G      |01/21  | 03    | 420
H      |01/28  | 04    | 1180

No t sure I got the table right, so here's an image of what I see.

What I'm trying to do is filter based on the date - say, all orders that occur before 1/21 - and then give the amount remaining in a list of machines.

So, if I wanted the total from Machine 1 and 4, the output from that table (with the date filter on) would be 2800, summing order A, D, E, and F. With the filter off it'd be 5580.

解决方案

Try this formula:

=SUMPRODUCT(NOT(ISERROR(MATCH($C:$C;J:J;0)))*SUBTOTAL(103;OFFSET(C1;ROW(C:C)-MIN(ROW(C:C));0));$D:$D)

Excel structure:

After applying a filter:

You can also include date criteria already in the formula:

=SUMPRODUCT(NOT(ISERROR(MATCH($C:$C;J:J;0)))*($B:$B<$L$1);$D:$D)

Where L1 is date criteria.

But, of course, if you need filter usage, use the first solution.

这篇关于如何将小计和sumif与一系列标准相结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆