简体   繁体   English

如何在Excel中创建具有动态年份的静态月/日

[英]how to create a Static month/day, with dynamic year in excel

I have a formula that incorporates a static date range from feb 1 to 28th. 我有一个公式,其中包含2月1日至28日的静态日期范围。 I need the dates to stay the same but the year to change. 我需要日期保持不变,但年份要更改。

=SUMIFS('2017 Booked Orders'!$H:$H,'2017 Booked Orders'!$C:$C,$B11, '2017 Booked Orders'!$M:$M,'Customer Dashboard'!$B$5, '2017 Booked Orders'!$K:$K, ">=2/1/2017" ,'2017 Booked Orders'!$K:$K, "<=2/28/2017" ) = SUMIFS('2017预订订单'!$ H:$ H,'2017预订订单'!$ C:$ C,$ B11,'2017预订订单'!$ M:$ M,'客户仪表板'!$ B $ 5 ,'2017预订订单'!$ K:$ K, “> = 2/1/2017” ,'2017预订订单'!$ K:$ K, “ <= 2/28/2017”

i want to reference a dynamic year cell but cant get the code to work in excel. 我想引用一个动态的年份单元格,但无法使代码在excel中工作。 Any help is really apreciated. 任何帮助都非常感谢。 I just need the year to change once we reach 2018, 2019 ext. 一旦我们达到2018年,2019年及以后,我只需要改变一年。 Not the month or date. 不是月份或日期。

you can use DATE() and refer to a cell for the year: 您可以使用DATE()并引用年份的单元格:

=SUMIFS('2017 Booked Orders'!$H:$H,'2017 Booked Orders'!$C:$C,$B11, '2017 Booked Orders'!$M:$M,'Customer Dashboard'!$B$5, '2017 Booked Orders'!$K:$K,">=" & DATE(A1,2,1),'2017 Booked Orders'!$K:$K,"<="  & DATE(A1,2,28))

Where A1 is the cell in which you put the year you want. A1是您要放置年份的单元格。

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

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