使用具有多个AND OR条件的SUMIFS [英] Using SUMIFS with multiple AND OR conditions

查看:633
本文介绍了使用具有多个AND OR条件的SUMIFS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个简洁的Excel公式,SUMS一列基于一组AND条件,加上一组OR条件。

I would like to create a succinct Excel formula that SUMS a column based on a set of AND conditions, plus a set of OR conditions.

我的Excel表包含以下数据和我使用列的定义名称。

My Excel table contains the following data and I used defined names for the columns.


  • Quote_Value(Worksheet!$ A:$ A)持有会计值。 / li>
  • Days_To_Close(Worksheet!$ B:$ B)包含导致一个数字的公式。

  • Salesman(Worksheet!$ C:$ C)包含文本,是一个名称。

  • Quote_Month(Worksheet!$ D:$ D)包含一个公式(= TEXT(Worksheet!$ E:$ E,mmm-yy))将日期/时间号从另一列转换为基于文本的月份参考。

如果Salesman等于JBloggs,我想要SUM Quote_Value, Days_To_Close等于或小于90,Quote_Month等于以下之一(Oct-13,Nov-13或Dec-13)。

I want to SUM Quote_Value if Salesman equals JBloggs and Days_To_Close is equal to or less than 90 and Quote_Month is equal to one of the following (Oct-13, Nov-13, or Dec-13).

此刻我有这个工作,但它包括很多重复,我不认为我需要。

At the moment, I've got this to work but it includes a lot of repetition, which I don't think I need.

=SUM(SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Oct-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Nov-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Dec-13"))

我想做的是某事更像以下内容,但我无法找出正确的语法:

What I'd like to do is something more like the following but I can't work out the correct syntax:

=SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,OR(Quote_Month="Oct-13",Quote_Month="Nov-13",Quote_Month="Dec-13"))

但是,如果我手动检查数据,那是不正确的。我甚至尝试使用TRIM(Quote_Month)来确保空格没有进入数据,但是我的扩展SUM公式工作的事实表明数据是正确的,这是一个语法问题。任何人都可以指导我正确的方向?

That formula doesn't error, it just returns a 0 value. Yet if I manually examine the data, that's not correct. I even tried using TRIM(Quote_Month) to make sure that spaces hadn't crept into the data but the fact that my extended SUM formula works indicates that the data is OK and that it's a syntax issue. Can anybody steer me in the right direction?

推荐答案

您可以使用 SUMIFS 这样

= SUM(SUMIFS(Quote_Value,Salesman,JBloggs,Days_To_Close,= 90,Quote_Month,{ Oct-13,Nov-13,Dec-13)))

SUMIFS 函数将返回一个3个值的数组(十进制,十一月十三号和十二月十三号共有一个)),所以您需要 SUM 来总结该数组,并给出最终结果。

The SUMIFS function will return an "array" of 3 values (one total each for "Oct-13", "Nov-13" and "Dec-13"), so you need SUM to sum that array and give you the final result.

请注意此语法,最多只能有 / strong>条件中的OR条件...,如果有两个,那么在一个中您必须将标准与逗号分开,另一个使用分号 strong>。

Be careful with this syntax, you can only have at most two criteria within the formula with "OR" conditions...and if there are two then in one you must separate the criteria with commas, in the other with semi-colons.

如果您需要更多,可以使用 SUMPRODUCT MATCH ,例如在您的情况下

If you need more you might use SUMPRODUCT with MATCH, e.g. in your case

= SUMPRODUCT(Quote_Value,(Salesman =JBloggs)*(Days_To_Close< = 90)* ISNUMBER(MATCH(Quote_Month, {Oct-13,Nov-13,Dec-13},0)))

在该版本中可以使用 ISNUMBER / MATCH

这篇关于使用具有多个AND OR条件的SUMIFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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