简体   繁体   English

年初至今本月和上一年的总和

[英]Sum current and prior year month-to-date to corresponding day of month

In the picture, I have a running monthly total at the bottom for THIS YEAR. 在图中,我今年本年度的底部每月总收入。 I have Last Year already populated. 我已经有去年。 How can I have LY monthly total only populate to where I am currently today? 我如何才能使LY的每月总数仅填充到我当前的位置?

SO25556816问题示例

Generalising (for lack of a clear requirements statement - but conveniently then possibly of wider relevance) if you have two columns of numeric values with one (say A) of 31 entries and a column label (in Row1) and the other (say B) of 15 entries and column label and you want to add both down only as far as the shorter column is populated then you might: 如果您有两列数值,其中一列(例如A)包含31个条目,一列标签(在Row1中),而另一列(例如B),则可以归纳(缺乏明确的需求陈述-但很可能随后具有更大的相关性) (共15个条目)和列标签,并且您只想在填充较短列的位置添加这两个元素,则可以:

In B32 enter =SUM(B2:B31) - to derive the "current month to date" total. 在B32中,输入=SUM(B2:B31) -得出“当前月份”总数。
In A32 enter =SUM(INDIRECT("A1:A"&MATCH(1E+100,B1:B31,1))) - to derive the sum of the same rows (but different column) as above. 在A32中,输入=SUM(INDIRECT("A1:A"&MATCH(1E+100,B1:B31,1))) -得出与上述相同(但不同列)的行之和。

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

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