[英]EXCEL Sum range based on row and column criteria
Given the Category table below:鉴于下面的类别表:
... how can I add all values in a particular category row that are in columns where the date header is <= TODAY()? ...如何在日期 header <= TODAY() 的列中添加特定类别行中的所有值?
For example, in cell B2 I want a running total of the values corresponding to the "Internet Bill" row and only columns where today (3/15) is >= the date in the column header.例如,在单元格 B2 中,我想要一个与“Internet Bill”行相对应的值的总和,并且只有今天(3/15)>= header 列中的日期的列。 I highlighted these values in red just for the example.
我只是为了示例而用红色突出显示了这些值。
Here's what I have so far in B2:这是我到目前为止在 B2 中的内容:
=SUM(INDEX($F$2:$J$4,MATCH($A2,$E2,0),MATCH(TODAY(),$F$1:$J$1,1)))
But it's only giving me "$45," which I understand correlates the greatest date value lesser than 3/15.但它只给了我“45 美元”,我知道这与小于 3/15 的最大日期值相关。 I just can't get the INDEX formula to return a column_num range filtered by a comparison operator...
我只是无法让 INDEX 公式返回由比较运算符过滤的 column_num 范围......
B2 G$1:J$1 requires date format, please change J1 to your actual range. B2 G$1:J$1 需要日期格式,请将 J1 更改为您的实际范围。
=SUM(OFFSET(F$1,MATCH(A2,E:E,)-1,,,COUNTIF(G$1:J$1,"<="&TODAY())))
Assuming you have office 365, you can use the formula below假设你有office 365,你可以使用下面的公式
=IFERROR(SUM(FILTER(FILTER($B$3:$N$4,$A$3:$A$4=B7),$B$2:$N$2<=$A$1)),"Not Found")
The formula also accounts for error supposing the data is not found假设未找到数据,该公式还解释了错误
Supposing your data table is in another Sheet (Sheet 1), you can use formula below假设您的数据表在另一张表(表 1)中,您可以使用下面的公式
=IFERROR(SUM(FILTER(FILTER(Sheet1!$B$3:$N$4,Sheet1!$A$3:$A$4=B2),Sheet1!$B$2:$N$2<=$A$1)),"Not Found")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.