如何在 Google 工作表中获取具有多个条件的最后记录?

How To Get Last Record with Multiple Criteria in Google Sheets?

我一直在从 Google 表单中添加记录,我需要将结果复制到不同的 sheet 传播sheet。

我有两个来自图像的例子(要清楚。)

  1. 我需要复制最后一条匹配“New York”“Reptiles”状态为“In Transit”的记录。

    结果应该是“5”

  2. 我需要复制最后一条匹配状态为“到达”的“加利福尼亚”“动物”的记录。

    结果应该是“70”

非常感谢您的反馈!你会给我带来一些理智!到时候你有时间解释一下为什么我会真心喜欢它。

请尝试:

=index(query(sort(A:E,Row(A:E),0),"where Col1='New York' and Col5='In Transit' limit 1"),1,match("Reptiles",1:1,0))  

=index(query(sort(A:E,Row(A:E),0),"where Col1='California' and Col5='Arrived' limit 1"),1,match("Animals",1:1,0))

你的选择是硬编码的,因为你没有指定在哪里可以找到你的选择。

=QUERY({A1:E}, "select Col3 
                where Col1='New York' 
                  and Col5='In Transit'  
                offset "&COUNTA(QUERY({A1:E}, "select Col3 
                                               where Col1='New York' 
                                                 and Col5='In Transit'", 0))-1, 0)


=QUERY({A1:E}, "select Col2 
                where Col1='California' 
                  and Col5='Arrived'  
                offset "&COUNTA(QUERY({A1:E}, "select Col2 
                                               where Col1='California' 
                                                 and Col5='Arrived'", 0))-1, 0)