对与 Date 参数具有相同月份的行求和
Sum rows that have the same month in relation to the Date parameter
我正在使用 Google 表格并且我有两个 table:
Table 1(记录):列 [进入日期、退出日期和持续时间] > 持续时间是退出日期和进入日期之间的差值。仅考虑一年的数据。
Table 2:12 列(每个月一列)。我需要在 table 中显示每个月的持续时间总和。
记录:
Entry Date
Exit Date
Duration
01/01/2021
02/01/2021
1
04/01/2021
06/01/2021
2
11/02/2021
15/02/2021
4
21/02/2021
24/02/2021
3
05/03/2021
06/03/2021
1
Table2 必须显示:
Jan
Feb
Mar
Apr
...
Dec
total duration
3
7
1
0
...
0
我应该用什么表情来做到这一点?任何 answers/suggestions/tips?
尝试:
=ARRAYFORMULA(REGEXREPLACE(""&QUERY({TEXT(A2:A, "mm\×mmm"), C2:C;
IFERROR(TEXT(SEQUENCE(12, 1, 1, 28), {"mm\×mmm", "[=10=]"*1}), 0)},
"select sum(Col2) pivot Col1"), "^\d+×", ))
我正在使用 Google 表格并且我有两个 table:
Table 1(记录):列 [进入日期、退出日期和持续时间] > 持续时间是退出日期和进入日期之间的差值。仅考虑一年的数据。
Table 2:12 列(每个月一列)。我需要在 table 中显示每个月的持续时间总和。
记录:
Entry Date | Exit Date | Duration |
---|---|---|
01/01/2021 | 02/01/2021 | 1 |
04/01/2021 | 06/01/2021 | 2 |
11/02/2021 | 15/02/2021 | 4 |
21/02/2021 | 24/02/2021 | 3 |
05/03/2021 | 06/03/2021 | 1 |
Table2 必须显示:
Jan | Feb | Mar | Apr | ... | Dec | |
---|---|---|---|---|---|---|
total duration | 3 | 7 | 1 | 0 | ... | 0 |
我应该用什么表情来做到这一点?任何 answers/suggestions/tips?
尝试:
=ARRAYFORMULA(REGEXREPLACE(""&QUERY({TEXT(A2:A, "mm\×mmm"), C2:C;
IFERROR(TEXT(SEQUENCE(12, 1, 1, 28), {"mm\×mmm", "[=10=]"*1}), 0)},
"select sum(Col2) pivot Col1"), "^\d+×", ))