搜索2列匹配的值并获得最小的值

时间:2018-03-17 00:14:22

标签: excel-formula google-sheets

例如:

Col1 | Col2 | NUMBER1
Fruit | Pear | 2
Fruit | Pear | 3
Fruit | Pear | 4
Fruit | Kiwi | 7
Fruit | Kiwi | 9
Car   | Honda| 4
Car   | Honda| 5

对于与前两列匹配的每一行,第四列的编号最小:

Col1 | Col2 | NUMBER1 | COMPARED NUMBER
Fruit | Pear | 2      | 2
Fruit | Pear | 3      | 2
Fruit | Pear | 4      | 2
Fruit | Kiwi | 7      | 7
Fruit | Kiwi | 9      | 7
Car   | Honda| 4      | 4
Car   | Honda| 5      | 4

是否有可能为此做一个功能?

3 个答案:

答案 0 :(得分:0)

中,在D2中尝试并填写,

=aggregate(15, 6, (c$2:c$8)/((a$2:a$8=a2)*(b$2:b$8=b2)), 1)

中,在D2中使用此功能并填写。

=minifs(C$2:C$8, A$2:A$8, A2, B$2:B$8, B2)

enter image description here

答案 1 :(得分:0)

在单元格D2中尝试此公式:

=IFERROR(ArrayFormula(vlookup(A2:A&B2:B,QUERY({A2:A&B2:B,C2:C},"order by Col1, Col2"),2,0)))

答案 2 :(得分:0)

假设您的数据按ColC,ColB和ColA排序,

D2:

=VLOOKUP(B2,B$2:C$12,2,0)

排序表:

Col1 | Col2 | NUMBER1
Fruit | Pear | 2
Fruit | Pear | 3
Fruit | Pear | 4
Fruit | Kiwi | 7
Fruit | Kiwi | 9
Car   | Honda| 4
Car   | Honda| 5

结果

Col1 | Col2 | NUMBER1 | Compared Number
Fruit | Pear | 2      | 2 [=VLOOKUP(B2,B$2:C$12,2,0)]
Fruit | Pear | 3      | 2
Fruit | Pear | 4      | 2
Fruit | Kiwi | 7      | 7
Fruit | Kiwi | 9      | 7
Car   | Honda| 4      | 4
Car   | Honda| 5      | 4