[英]How to SUM a range in Excel based on CELL/INDEX/MATCH
I am trying to sum a range in Excel.我正在尝试在 Excel 中求和一个范围。 I want users to be able to enter a date in one cell.
我希望用户能够在一个单元格中输入日期。 Then I want to sum a range based on a static starting cell location and the corresponding location based on the date they enter.
然后,我想根据静态起始单元格位置和基于它们输入的日期的相应位置求和一个范围。 For example, if they enter 1/3/2021 for the report date, I want to sum the range between B2 and B4 to get $14.
例如,如果他们输入 2021 年 1 月 3 日作为报告日期,我想将 B2 和 B4 之间的范围相加得到 14 美元。 I have the following formula which gives me an error.
我有以下公式,这给了我一个错误。 Any ideas on how to get this formula to work as expected?
关于如何让这个公式按预期工作的任何想法? Thanks for your help!
谢谢你的帮助!
=SUM(B2:CELL("address",INDEX(A2:B63,MATCH(G1,A2:A63,1),2))) =SUM(B2:CELL("地址",INDEX(A2:B63,MATCH(G1,A2:A63,1),2)))
Date![]() |
Sales![]() |
Misc Column![]() |
Misc Value![]() |
---|---|---|---|
1/1/2021 ![]() |
$3 ![]() |
Report Date![]() |
1/4/2021 ![]() |
1/2/2021 ![]() |
$6 ![]() |
Sales Total Formula![]() |
=SUM(B2:CELL("address",INDEX(A2:B5,MATCH(D2,A1:A5,1)2))) ![]() |
1/3/2021 ![]() |
$5 ![]() |
Sales Total (expected value)![]() |
$21 ![]() |
1/4/2021 ![]() |
$7 ![]() |
Sales Total (actual value)![]() |
I get an error![]() |
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.