1
votes

I have cell A1, and then below 4 columns. Cell A1 right now contains number 2.

2 

|  A   |  B   |  C   | SELECTED |
|  12  |  44  |  88  | 44       |
|  43  |  55  |  99  | 55       |
|  54  |  66  |  11  | 66       |

Which formula should I put into 'Selected' column to display there values of the second column? I would like the A1 cell to control which values are displayed there. Basically, I'm looking for a similar functionality to a VLOOKUP, except there is no lookup and it just takes range a4:c4 and selectes column number A1.

2
Use the INDEX() function.Gary's Student

2 Answers

2
votes

You can use INDEX() for that. Let's say that 12, 44 and 88 are in columns A, B and C respectively, and on row 4.

In the first cell under SELECTED, you can put this:

=INDEX(A4:C4, 0, A$1)

And then you can drag this down to get the remaining rows.

INDEX takes the whole row (hence the 0) and the column from the value in A$1 from the range A4:C4.

1
votes

In D2 enter:

=INDEX(A:C,ROW(),$A$1)

and copy down