如何对相似的单元格进行分组并获得这些单元格中的最大值?
How do I group similar cells and get the maximum value among those cells?
╔══════╦════════════════════╦══════════╗
║ Name ║ Date ║ Stage ║
╠══════╬════════════════════╬══════════╣
║ Dave ║ 4/29/2016 12:15:36 ║ Booking ║
║ Dave ║ 4/29/2016 17:58:24 ║ Booking ║
║ Dave ║ 4/29/2016 11:32:59 ║ Costing ║
║ Dave ║ 4/29/2016 16:52:47 ║ Costing ║
║ Dave ║ 4/27/2016 16:59:27 ║ Lead ║
║ Mark ║ 4/22/2016 12:55:22 ║ Booking ║
║ Mark ║ 4/24/2016 8:00:45 ║ Booking ║
║ Mark ║ 4/24/2016 10:07:01 ║ Booking ║
║ Mark ║ 4/24/2016 14:15:30 ║ Booking ║
║ Mark ║ 4/24/2016 18:55:22 ║ Booking ║
║ Mark ║ 4/24/2016 21:33:12 ║ Booking ║
║ Mark ║ 4/20/2016 12:55:22 ║ New ║
║ Mark ║ 4/23/2016 16:32:22 ║ Planning ║
║ Mark ║ 4/24/2016 9:11:36 ║ Won ║
║ Mark ║ 4/24/2016 12:55:22 ║ Won ║
║ Mark ║ 4/24/2016 17:04:02 ║ Won ║
║ Mark ║ 4/24/2016 19:55:22 ║ Won ║
║ Mark ║ 4/25/2016 10:19:13 ║ Won ║
╚══════╩════════════════════╩══════════╝
我的 Google 电子表格中有上述 table。我想要做的是对重复的阶段进行分组,return 每组阶段的最大日期。
我知道如何通过这样做获得所有单元格的最大日期:
=max(arrayformula((B:B=B2)*(C:C)))
但是,我想 return 每个阶段的最大日期。我希望我的 table 如下所示:
╔══════╦════════════════════╦══════════╦════════════════════╗
║ Name ║ Date ║ Stage ║ Max Date ║
╠══════╬════════════════════╬══════════╬════════════════════╣
║ Dave ║ 4/29/2016 12:15:36 ║ Booking ║ 4/29/2016 17:58:24 ║
║ Dave ║ 4/29/2016 17:58:24 ║ Booking ║ 4/29/2016 17:58:24 ║
║ Dave ║ 4/29/2016 11:32:59 ║ Costing ║ 4/29/2016 16:52:47 ║
║ Dave ║ 4/29/2016 16:52:47 ║ Costing ║ 4/29/2016 16:52:47 ║
║ Dave ║ 4/27/2016 16:59:27 ║ Lead ║ 4/27/2016 16:59:27 ║
║ Mark ║ 4/22/2016 12:55:22 ║ Booking ║ 4/24/2016 21:33:12 ║
║ Mark ║ 4/24/2016 8:00:45 ║ Booking ║ 4/24/2016 21:33:12 ║
║ Mark ║ 4/24/2016 10:07:01 ║ Booking ║ 4/24/2016 21:33:12 ║
║ Mark ║ 4/24/2016 14:15:30 ║ Booking ║ 4/24/2016 21:33:12 ║
║ Mark ║ 4/24/2016 18:55:22 ║ Booking ║ 4/24/2016 21:33:12 ║
║ Mark ║ 4/24/2016 21:33:12 ║ Booking ║ 4/24/2016 21:33:12 ║
║ Mark ║ 4/20/2016 12:55:22 ║ New ║ 4/20/2016 12:55:22 ║
║ Mark ║ 4/23/2016 16:32:22 ║ Planning ║ 4/23/2016 16:32:22 ║
║ Mark ║ 4/24/2016 9:11:36 ║ Won ║ 4/25/2016 10:19:13 ║
║ Mark ║ 4/24/2016 12:55:22 ║ Won ║ 4/25/2016 10:19:13 ║
║ Mark ║ 4/24/2016 17:04:02 ║ Won ║ 4/25/2016 10:19:13 ║
║ Mark ║ 4/24/2016 19:55:22 ║ Won ║ 4/25/2016 10:19:13 ║
║ Mark ║ 4/25/2016 10:19:13 ║ Won ║ 4/25/2016 10:19:13 ║
╚══════╩════════════════════╩══════════╩════════════════════╝
尝试使用查询。在D2中输入,将公式复制下来:
=query($A2:$C19,"select B where A='" & A2 &"' and C='" & C2 &"' order by B desc limit 1 ")
Select B 获取日期。其中 A = '" & A2 &"' 限制为单元格 A2 中的值(名称)。 C2= 对 C2 中的单元格值执行相同的操作。它按日期排序。在这种情况下降序。限制 1 有效地获取最大日期,因为它只有 returns 一个值。我希望解释查询。
╔══════╦════════════════════╦══════════╗ ║ Name ║ Date ║ Stage ║ ╠══════╬════════════════════╬══════════╣ ║ Dave ║ 4/29/2016 12:15:36 ║ Booking ║ ║ Dave ║ 4/29/2016 17:58:24 ║ Booking ║ ║ Dave ║ 4/29/2016 11:32:59 ║ Costing ║ ║ Dave ║ 4/29/2016 16:52:47 ║ Costing ║ ║ Dave ║ 4/27/2016 16:59:27 ║ Lead ║ ║ Mark ║ 4/22/2016 12:55:22 ║ Booking ║ ║ Mark ║ 4/24/2016 8:00:45 ║ Booking ║ ║ Mark ║ 4/24/2016 10:07:01 ║ Booking ║ ║ Mark ║ 4/24/2016 14:15:30 ║ Booking ║ ║ Mark ║ 4/24/2016 18:55:22 ║ Booking ║ ║ Mark ║ 4/24/2016 21:33:12 ║ Booking ║ ║ Mark ║ 4/20/2016 12:55:22 ║ New ║ ║ Mark ║ 4/23/2016 16:32:22 ║ Planning ║ ║ Mark ║ 4/24/2016 9:11:36 ║ Won ║ ║ Mark ║ 4/24/2016 12:55:22 ║ Won ║ ║ Mark ║ 4/24/2016 17:04:02 ║ Won ║ ║ Mark ║ 4/24/2016 19:55:22 ║ Won ║ ║ Mark ║ 4/25/2016 10:19:13 ║ Won ║ ╚══════╩════════════════════╩══════════╝
我的 Google 电子表格中有上述 table。我想要做的是对重复的阶段进行分组,return 每组阶段的最大日期。
我知道如何通过这样做获得所有单元格的最大日期:
=max(arrayformula((B:B=B2)*(C:C)))
但是,我想 return 每个阶段的最大日期。我希望我的 table 如下所示:
╔══════╦════════════════════╦══════════╦════════════════════╗ ║ Name ║ Date ║ Stage ║ Max Date ║ ╠══════╬════════════════════╬══════════╬════════════════════╣ ║ Dave ║ 4/29/2016 12:15:36 ║ Booking ║ 4/29/2016 17:58:24 ║ ║ Dave ║ 4/29/2016 17:58:24 ║ Booking ║ 4/29/2016 17:58:24 ║ ║ Dave ║ 4/29/2016 11:32:59 ║ Costing ║ 4/29/2016 16:52:47 ║ ║ Dave ║ 4/29/2016 16:52:47 ║ Costing ║ 4/29/2016 16:52:47 ║ ║ Dave ║ 4/27/2016 16:59:27 ║ Lead ║ 4/27/2016 16:59:27 ║ ║ Mark ║ 4/22/2016 12:55:22 ║ Booking ║ 4/24/2016 21:33:12 ║ ║ Mark ║ 4/24/2016 8:00:45 ║ Booking ║ 4/24/2016 21:33:12 ║ ║ Mark ║ 4/24/2016 10:07:01 ║ Booking ║ 4/24/2016 21:33:12 ║ ║ Mark ║ 4/24/2016 14:15:30 ║ Booking ║ 4/24/2016 21:33:12 ║ ║ Mark ║ 4/24/2016 18:55:22 ║ Booking ║ 4/24/2016 21:33:12 ║ ║ Mark ║ 4/24/2016 21:33:12 ║ Booking ║ 4/24/2016 21:33:12 ║ ║ Mark ║ 4/20/2016 12:55:22 ║ New ║ 4/20/2016 12:55:22 ║ ║ Mark ║ 4/23/2016 16:32:22 ║ Planning ║ 4/23/2016 16:32:22 ║ ║ Mark ║ 4/24/2016 9:11:36 ║ Won ║ 4/25/2016 10:19:13 ║ ║ Mark ║ 4/24/2016 12:55:22 ║ Won ║ 4/25/2016 10:19:13 ║ ║ Mark ║ 4/24/2016 17:04:02 ║ Won ║ 4/25/2016 10:19:13 ║ ║ Mark ║ 4/24/2016 19:55:22 ║ Won ║ 4/25/2016 10:19:13 ║ ║ Mark ║ 4/25/2016 10:19:13 ║ Won ║ 4/25/2016 10:19:13 ║ ╚══════╩════════════════════╩══════════╩════════════════════╝
尝试使用查询。在D2中输入,将公式复制下来:
=query($A2:$C19,"select B where A='" & A2 &"' and C='" & C2 &"' order by B desc limit 1 ")
Select B 获取日期。其中 A = '" & A2 &"' 限制为单元格 A2 中的值(名称)。 C2= 对 C2 中的单元格值执行相同的操作。它按日期排序。在这种情况下降序。限制 1 有效地获取最大日期,因为它只有 returns 一个值。我希望解释查询。