Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sorting 第一个非零结果的索引匹配_Sorting_Google Sheets_Filter_Match_Google Sheets Formula - Fatal编程技术网

Sorting 第一个非零结果的索引匹配

Sorting 第一个非零结果的索引匹配,sorting,google-sheets,filter,match,google-sheets-formula,Sorting,Google Sheets,Filter,Match,Google Sheets Formula,尝试执行索引/匹配查找以在多个匹配中查找第一个非零结果。不知道该怎么做。下面是示例数据 Foo 1 bar 0 bar 2 要执行以下操作: =INDEX(B:B,MATCH("Foo",A:A,0)) =INDEX(B:B,MATCH("bar",B:B,0)) 希望上面的结果返回1和2,但显然根据上面的表将得到1和0。如何从匹配中排除0值?尝试: =FILTER(B:B, B:B<>0) =过滤器(B:B,B:B0) 如果这还不够,您可以: =INDEX(SORTN(FI

尝试执行索引/匹配查找以在多个匹配中查找第一个非零结果。不知道该怎么做。下面是示例数据

Foo 1
bar 0
bar 2
要执行以下操作:

=INDEX(B:B,MATCH("Foo",A:A,0))
=INDEX(B:B,MATCH("bar",B:B,0))
希望上面的结果返回1和2,但显然根据上面的表将得到1和0。如何从匹配中排除0值?

尝试:

=FILTER(B:B, B:B<>0)
=过滤器(B:B,B:B0)
如果这还不够,您可以:

=INDEX(SORTN(FILTER(A:B, B:B<>0), 9^9, 2, 1, 0),,2)
=索引(SORTN(过滤器(A:B,B:B0),9^9,2,1,0),2)
如果这仍然不够,请尝试:

=INDEX(SORT(SORTN(FILTER({A:B, ROW(A:A)}, B:B<>0), 9^9, 2, 1, 0), 3, 1),,2)
=索引(排序(SORTN(过滤器({A:B,行(A:A)},B:B0),9^9,2,1,0),3,1),2)

过滤和排序是一种方法,但如果您确实想通过经典索引/匹配来实现,您需要

=index(B:B,match(1,(A:A="Bar")*(B:B<>0),0))
=索引(B:B,匹配(1,(A:A=“Bar”)*(B:B0),0))