简体   繁体   English

基于sumif的Excel函数数组公式以查找最小计数

[英]Excel function array formula based on sumif to find minimum count

I have some data where I want to find the minimum number of days it takes to reach a total sum based on some criteria. 我有一些数据,我想根据某些条件找到达到总金额所需的最少天数。

Essentially the data is like this: 本质上,数据是这样的:

Date        Season  Recieval
1/01/2006   2006    500
2/01/2006   2006    100
3/01/2006   2006    150
…       
10/12/2009  2009    300

etc 等等

Want I want to do is find a formula that finds the minimum number of days it takes to reach a receivals total for the season. 我想要做的是找到一个公式,该公式可以找到达到该季节的收货总额所需的最少天数。

The formula below is what I have tried so far with no avail. 到目前为止,下面的公式是我一直没有尝试过的方法。

 =MIN(COUNT(IF(SUMIFS(C:C,B:B,"2006")>2000,DATA!A:A)))

It doesn't matter what point it starts from, but it must take the minimum number of days to reach the 2000. 它从哪一点开始都没有关系,但是必须至少花几天的时间才能达到2000。

Output should be a number eg 39 (39 days consecutive to sum up to receivals of 2000). 输出应该是一个数字,例如39(连续39天,总计2000年的接收)。

Essentially what I want to generate is the minimum number of consecutive days required to reach the total of 2000, regardless of the starting point. 本质上,无论起点是什么,我想要生成的是达到2000总数所需的最小连续天数。

Cheers! 干杯!

If your Dates are in the range A2:A25 and Recieval in C2:C25, then try this... 如果您的日期在A2:A25范围内,并且在C2:C25内接收,那么请尝试此...

=INDEX(A2:A25,MATCH(TRUE,INDEX(SUBTOTAL(9,(OFFSET(C$2:C25,,,ROW(INDIRECT("1:25")),1)))>=2000,),0))-A2

The formula will get you the no. 该公式将使您获得成功。 of days to reach total 2000 receival in column C. C栏达到2000年总接收天数的天数。

Or if you just need to count the consecutive dates, please try.. 或者,如果您只需要计算连续的日期,请尝试..

=MATCH(TRUE,INDEX(SUBTOTAL(9,(OFFSET(C$2:C25,,,ROW(INDIRECT("1:25")),1)))>=2000,),0)

Remember both the formulas are Array Formulas which require a special key stroke Ctrl+Shift+Enter instead of Enter alone. 请记住,两个公式都是“ 数组公式” ,它们需要特殊的击键Ctrl + Shift + Enter,而不是单独的Enter。

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

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