[英]Is there a formula for upcoming date using formula in Google sheet based on condition?
I have a google sheet where I need to get the next upcoming date based on the start date set in column A我有一个谷歌表,我需要根据 A 列中设置的开始日期来获取下一个即将到来的日期
Any pointers are greatly appreciated?任何指针都非常感谢? I am unable exhibit the efforts as I am completely new to this sort of recurrence using Google sheets
我无法展示这些努力,因为我对使用 Google 表格的这种重复行为完全陌生
https://docs.google.com/spreadsheets/d/1g_UNg4MjDy3gFufpjZtMRkbBz80K3scQdZOaiAnZi7I/edit#gid=0 https://docs.google.com/spreadsheets/d/1g_UNg4MjDy3gFufpjZtMRkbBz80K3scQdZOaiAnZi7I/edit#gid=0
This behavior (the next date from today including today) could be implemented manually by this formula:这种行为(从今天开始的下一个日期,包括今天)可以通过这个公式手动实现:
={
"Next date from today";
ARRAYFORMULA(
IFS(
A2:A >= TODAY(),
A2:A,
B2:B = "Daily",
TODAY() + MOD(TODAY() - A2:A, C2:C),
B2:B = "Weekly",
TODAY() + MOD(TODAY() - A2:A, 7 * C2:C),
B2:B = "Monthly",
EDATE(A2:A, ROUNDUP((12 * (YEAR(TODAY()) - YEAR(A2:A)) + (MONTH(TODAY()) - MONTH(A2:A)) - IF(DAY(TODAY()) < DAY(A2:A), 1, 0)) / C2:C, 0) * C2:C),
True,
""
)
)
}
For additional options (like "every 2nd monday of the month" and others) additional options should be implemented in that IFS
part.对于其他选项(例如“每月的第二个星期一”等),应在该
IFS
部分实施其他选项。
If you are interested in a trivial case where the next date from the start date (column F:F
on the screenshot) is needed, then the formula would be much simpler:如果您对需要从开始日期开始的下一个日期(屏幕截图上的
F:F
列)的简单情况感兴趣,那么公式会简单得多:
={
"Next date";
ARRAYFORMULA(
IFS(
B2:B = "Daily",
A2:A + C2:C,
B2:B = "Weekly",
A2:A + 7 * C2:C,
B2:B = "Monthly",
EDATE(A2:A, C2:C),
True,
""
)
)
}
Again, for additional options you'll need to add corresponding part to the IFS
.同样,对于其他选项,您需要将相应的部分添加到
IFS
。
You could use IFS to check Frequency
, and:您可以使用IFS检查
Frequency
,并且:
Daily
, add Count
value to start date.Daily
,将Count
值添加到开始日期。Weekly
, add Count
value multiplied by 7.Weekly
,则添加Count
值乘以 7。Monthly
, since not all months have the same duration, retrieve the YEAR
, MONTH
and DAY
indexes, add Count
to the MONTH index, and set a new DATE , EDIT : or as suggested by kishkin , use EDATE .Monthly
,因为并非所有月份都具有相同的持续时间,请检索YEAR
、 MONTH
和DAY
索引,将Count
添加到MONTH索引,并设置一个新的DATE , EDIT :或按照kishkin的建议,使用EDATE 。 It could be something like this:它可能是这样的:
=ARRAYFORMULA(IFNA(IFS(
B2:B = "Daily", A2:A + C2:C,
B2:B = "Weekly", A2:A + 7 * C2:C,
B2:B = "Monthly", EDATE(A2:A,C2:C)
)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.