cell reference based on value in another cell

I think this should be easy, but I can't figure out quite how to do it.

Here is a simple representation

     A     B     C     D     E
1   2                   2
2   4
3   6
4
5
6    x
In the cell A6 I need a function that returns the value in A1, A2 or A3 depending on the value of the relevant row in D1.

eg If D1 = 1 A6 is the value in A1.  If D1 = 3 A6 is the value in A3. etc

What is the easiest way of indicating a row reference based on the value in a given cell?

Best regards

Richard
rltomalinAsked:
Who is Participating?
 
Rory ArchibaldConnect With a Mentor Commented:
=INDEX(A1:A5,D1)
should work.
0
 
theKashyapConnect With a Mentor Commented:
Try this formula:
=OFFSET(A1,D1-1,0)
0
 
Saqib Husain, SyedConnect With a Mentor EngineerCommented:
or

=indirect("A"&D1)
0
 
rltomalinAuthor Commented:
Thanks for the input.  All three solutions are clear and do the job.  I just chose one of course - shared points equally.

Regards

Richard
0
 
Saqib Husain, SyedEngineerCommented:
Which one? ;-)

Thanks for the points
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.