Pass row number as variable in excel sheet

Yashpal Singla picture Yashpal Singla · Nov 6, 2012 · Viewed 166.2k times · Source

Suppose I have:

  1. a value of 5 in B1
  2. I want to pass the number (5) in B1 as a row variable, which will be read in conjunction with column A into another cell (say C1) as "=A(B1)" i.e. "=A5"

How would I do this?

Answer

RocketDonkey picture RocketDonkey · Nov 6, 2012

Assuming your row number is in B1, you can use INDIRECT:

=INDIRECT("A" & B1)

This takes a cell reference as a string (in this case, the concatenation of A and the value of B1 - 5), and returns the value at that cell.