Adam Scot
Adam Scot

Reputation: 1409

Is it possible to use an array within a Google Sheets function

Is it possible to have an array within a formula, as opposed to referencing the array in cells.

For example with VLOOKUP, I have tried to do this but it doesn't work:

=VLOOKUP(I2,[["Superking",4],["King",3],["Double",2],["Single",1]],2,0)

I'm essentially trying to incorporate the below table into the formula itself:

Superking      4
-----------------------------
King           3
-----------------------------
Double         2
-----------------------------
Single         1

I thought that this is maybe possisble but expressing the array incorrectly.

I do know that this can easily be done by putting the actual data into the sheet, but I am interested to know if it is posisble to do it this way.

Upvotes: 2

Views: 48

Answers (2)

Gabriel Pierce
Gabriel Pierce

Reputation: 406

Yeah, this is the format to do it.

={"one","two","three","four","five";1,2,3,4,5}

will produce

img of an array splayed

Upvotes: 1

JohnA
JohnA

Reputation: 1107

This seems to work:

=vlookup("Pete", {{"John",9};{"Pete", 2}}, 2, false)

Upvotes: 3

Related Questions