Google Sheets, arrayformula 只返回一次值

Google Sheets, arrayformula only returning value once

如何使 Google 表格 arrayformula+vlookup(或 if 语句)return 值不止一次?现在它默认为 returning 值,但如果它再次列出则不会这样做。目前看起来像这样:

=ARRAYFORMULA((IF(ROW(A:A)=1,"Class", 
if(G:G=Sheet3!C:C,"Fruit"," "))))

G 列是“类型”列

类型,Class

Apple, Fruit
Apple, N/A
Apple, N/A
Banana, Fruit
Banana, N/A

Link 举例 sheet

https://docs.google.com/spreadsheets/d/10Z9JhGSQ7oi3hyYUBjcx3kAWo2ASrqovIk5OOCsv4Hk/edit?usp=sharing

你可以使用下面的公式

={"Class";ArrayFormula(IFERROR(VLOOKUP(B2:B,Sheet2!A2:B,2,0)))}

Sheet2!A2:B 具有值时

+------------+-------+
|   Class    | Type  |
+------------+-------+
| Apple      | Fruit |
| Orange     | Fruit |
| Kiwi       | Fruit |
| Watermelon | Fruit |
| Banana     | Fruit |
+------------+-------+

使用的函数: