Years of seasons from dates in Google Sheets 从Google Sheets中的日期获取季节的年份

huangapple go评论48阅读模式
英文:

Years of seasons from dates in Google Sheets

问题

我明白你的要求,以下是翻译好的部分:

有一个包含身体部位和日期的数组。应该如何编写一个公式,首先按照身体部位分组,然后按照条件(每个身体部位的相邻日期之间的间隔不超过30天)分组,然后输出在该组内的年份

例如,有6组日期。对于每组,我需要输出在该组内的年份(例如,如果有两年,2022年和2023年,那么输出22/23;如果只有一年,2021年,那么这一年加1,我们得到21/22)。

英文:

There is an array with a body part and dates. What should a formula look like that splits it first by body parts, and then by the condition (the interval between each next date is no more than 30 days for each body part) into groups, and then outputs the years that are within that group?

For example, there are 6 groups of dates. For each group I need to output the years that are within this group (for example, if there are two years 2022 and 2023, then output 22/23, if there is only one 2021, then this year + 1, we get 21/22)
Years of seasons from dates in Google Sheets
从Google Sheets中的日期获取季节的年份
https://docs.google.com/spreadsheets/d/1Haqs37snvnBUyGO8quwfpp-nGIMOaTdgyW1S7V3rUdg/edit#gid=0

答案1

得分: 2

以下是翻译好的部分:

"你可以尝试: =let(Σ;{1;scan(1;B3:index(B:B;match(;0/(B:B<>"";));lambda(a;c;if(isbetween(days(c;offset(c;-1;));0;30)*(offset(c;;-1)=offset(c;-1;-1));a;a+1)))}; map(Σ;lambda(Γ;let(Λ;text(minifs(B2:index(B:B;match(;0/(B:B<>"";));Σ;Γ);"y");Λ&&"/"&Λ+1)))) - group_1 output is kinda mismatching with your expected output"

希望这有所帮助。如果您需要进一步的翻译或其他帮助,请随时提问。

英文:

You may try:

=let(Σ;{1;scan(1;B3:index(B:B;match(;0/(B:B&lt;&gt;&quot;&quot;)));lambda(a;c;if(isbetween(days(c;offset(c;-1;));0;30)*(offset(c;;-1)=offset(c;-1;-1));a;a+1)))};
       map(Σ;lambda(Γ;let(Λ;text(minifs(B2:index(B:B;match(;0/(B:B&lt;&gt;&quot;&quot;)));Σ;Γ);&quot;y&quot;);Λ&amp;&quot;/&quot;&amp;Λ+1))))
  • group_1 output is kinda mismatching with your expected output

Years of seasons from dates in Google Sheets
从Google Sheets中的日期获取季节的年份

huangapple
  • 本文由 发表于 2023年5月13日 19:57:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76242606.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定