Here is a better update. I've included a screenshot that illustrates what I am trying to do. I am trying to write a function that does this automatically instead of me having to do it all manually.
I have an Excel sheet that contains 6,568 rows of data. For one of the columns, E, I am trying to create subtotals for all of the times that the flow rate drops below 5. I have included a screenshot as an example.
What am I trying to do is create a function that scans the entirety of column E and sums up the times (column A) for when the value of column E is below 5.
I thought I could do this when an IF statement, but I do not think that is the best way. Maybe "SUMIF", but I don't think that is right either. Is this something better suited for VBA?
This is what I started with:
IF(E2270<5, IF(E2271<5), blah blah blah)
I am a little stumped here though. Any help is appreciated.
EDIT
Here is a screenshot with headers
答案 0 :(得分:0)
Col C.少于5?
=IF(B2<=5, C1+1, 0)
这是一个辅助行,它计算自我们进入&lt; 5期间以来的单元格数。这将有助于我们创建我们需要的范围。
Col D.是最后一个吗?
=IF(AND(C2>0, C3=0), 1, 0)
这只是一个简单的布尔值,如果这是一个句点的结束,那么我们应该进行计算。
Col E.流量总和
=IF(D2=1, SUM(OFFSET(B2, -1*(C2-1), 0, C2, 1)), "")
如果这是期间的结束,则将从当前时间段到期间开始的流量相加。我们通过从最高的最小值到当前值执行一系列Col C. Less than 5?
行和1列来完成此操作。
Col F.流动时间
=IF(D2=1, A2-OFFSET(A2, -1*(C2-1), 0), "")
这与Col E类似。如果时间间隔一致,那么您可以将时间间隔乘以Col C
而不是减去。
您现在可以隐藏Col C
和Col D
,因为它们不需要显示。