aSystemOverload
aSystemOverload

Reputation: 3114

Using a string key to return a value from an array

I have a named array of 14 rows by 2 columns. The first has a string key (ie: Country), and the second an attribute (ie: Owner). I want to retrieve the Owner by supplying the Country.

I only know how to use =INDEX to retrieve values from named arrays, but that expects col/row numbers.

How might I achieve my requirement?

Upvotes: 0

Views: 215

Answers (1)

pnuts
pnuts

Reputation: 59495

For the sake of an answer.

Feed the INDEX function with a MATCH function to provide the requisite row number, along the lines:

=INDEX(B:B,MATCH(A2,A:A,0))

VLOOKUP will work but INDEX/MATCH is more powerful (see) so if you are already comfortable with INDEX it might be better to add MATCH to your arsenal rather than to bother with V/H LOOKUP.

Upvotes: 2

Related Questions