使用数组获取 x 的计数

问题描述 投票:0回答:1
rows    A     B
1       1   Joe
2       2   Bill
3       3   Pete
4       4   Victor
5       5   Don
6       6   Victor
7       7   Bob

=ArrayFormula(LOOKUP(2,1/(b1:b7="Victor"),(a1:a7)))

这将输出 6,因为我已经对 A 中的行进行了编号。如何将 count() 添加到数组中,以便它实际上计算到(最后一个)Victor 的行?

arrays google-sheets indexing count
1个回答
0
投票

要获取 B 列中直到最后一次出现“Victor”为止的行数,可以使用以下公式:

=ROWS(B1:XLOOKUP("Victor",B:B,B:B,,,-1))

© www.soinside.com 2019 - 2024. All rights reserved.