Reputation: 7
How can I make a Google Sheets arrayformula+vlookup(or if statements) return the value more than once? Right now it defaults to returning the value but doesnt do it if its listed again. Currently looks something like this:
=ARRAYFORMULA((IF(ROW(A:A)=1,"Class",
if(G:G=Sheet3!C:C,"Fruit"," "))))
Column G being the "Type" Column
Type, Class
Apple, Fruit
Apple, N/A
Apple, N/A
Banana, Fruit
Banana, N/A
Link to example sheet
https://docs.google.com/spreadsheets/d/10Z9JhGSQ7oi3hyYUBjcx3kAWo2ASrqovIk5OOCsv4Hk/edit?usp=sharing
Upvotes: 0
Views: 1075
Reputation: 10573
You can use the following formula
={"Class";ArrayFormula(IFERROR(VLOOKUP(B2:B,Sheet2!A2:B,2,0)))}
When Sheet2!A2:B
has the values
+------------+-------+
| Class | Type |
+------------+-------+
| Apple | Fruit |
| Orange | Fruit |
| Kiwi | Fruit |
| Watermelon | Fruit |
| Banana | Fruit |
+------------+-------+
Functions used:
Upvotes: 2