Sumif 月份 > 指定日期

Sumif months > specified date

数据框

 name subscribe_date 1/2019 2/2019  3/2019  .......  1/2021 2/2021 3/2021
2 Andy   2020-10-01      50     30     20       .......    200    40      60

我想创建一个 post_subs_total 列,该列在订阅日期之后的月份中从单元格 1/2021 到 3/2021 获取第 2 行的总和。

在上面的示例中,结果将是:

 name subscribe_date 1/2020 2/2020  3/2020  .......  1/2021 2/2021 3/2021 post_subs_total
2 Andy   2020-10-01      50     30     20       .......    200    40      60        300

数据必须保持水平格式,因为我想知道每个客户在他的订阅日期之后花了多少钱。

首先确保包含您的日期的 header 行确实是“m/yyyy”的 Excel date values. You can have them formatted to look exactly the same (e.g. "3/2019") by formatting those cells using the custom date format,或者您选择的任何其他格式。

要为工作表的图像生成“post_subs_total”,请在单元格 R2 中使用此公式:

=SUMIFS(C2:Q2,C1:Q1,">="&B2)