[英]Sum rows in one column between 2 time range
Is there a way to sum values in a column between two different time.有没有办法在两个不同时间之间对列中的值求和。 The two different hrs are different for different start and end calculation.
这两个不同的小时对于不同的开始和结束计算是不同的。 The formula i used is
=SUMIFS(Period,time,">="&Time Range,time, Range,"<="&Time Range)
, but the formula returns only the first hour value but the expected result should be between total of start calc and end cal value我使用的公式是
=SUMIFS(Period,time,">="&Time Range,time, Range,"<="&Time Range)
,但该公式仅返回第一个小时值,但预期结果应介于 start 总数之间calc 和 end cal 值
time period Cal stat Time Range Expected Result
6:37:02 AM 1 start calc 6:37:02 AM 4
6:37:03 AM 1 no action 0
6:37:04 AM 2 End Calc 6:37:04 AM
6:37:06 AM 1 Start Calc 6:37:06 AM 6
6:37:07 AM 1 no action 0
6:37:08 AM 2 no action 0
6:37:10 AM 1 no action 0
6:37:11 AM 1 End Calc 6:37:11 AM
6:37:12 AM 2 Start Calc 6:37:12 AM 3
6:37:14 AM 1 End Calc 6:37:14 AM
6:37:15 AM 1 no action 0
6:37:16 AM 1 no action 0
6:37:17 AM 2 no action 0
6:37:19 AM 2 no action 0
I don't know about doing it with SUMIFS
.我不知道用
SUMIFS
来做。
However, with INDEX(MATCH(…
, you can construct a formula that will sum from the current row to the next "end Calc"
, and use an IF(…
to only show results in the start calc
rows.但是,使用
INDEX(MATCH(…
,您可以构造一个公式,从当前行求和到下一个"end Calc"
,并使用IF(…
仅在start calc
行中显示结果。
E2: =IF(C2="start calc", SUM( INDEX(B2:$B$15,1): INDEX(B2:$B$15,MATCH(TRUE,C2:$C$15="end Calc",0))),"")
$15
row numbers in the formula can be changed to any row that is at least as large as your expected table, but be sure it remains an absolute address.$15
行号可以更改为至少与预期表一样大的任何行,但请确保它仍然是绝对地址。
=IF(C2="start calc", SUM( INDEX(B2:$B$1500,1): INDEX(B2:$B$1500,MATCH(TRUE,C2:$C$1500="end Calc",0))),"")
=IF(C2="start calc", SUM( INDEX(B2:$B$1500,1): INDEX(B2:$B$1500,MATCH(TRUE,C2:$C$1500="end Calc",0))),"")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.