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

Viewed 42

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.

2 Answers

This seems to work:

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

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

Related