Using Row Numbers as values in a cell


Posted by Lewis on November 11, 2001 3:55 PM

Is it possible to read the row number and convert it to a value in a cell.
For example if I am in Row 12 can I make the value in A12 = 12.

Conversely if I enter a number in a cell can I use it then to find a cell in that row.
For example if I put 12 in cell A1 can I then use that to go to D12.

Thanks in advance

Posted by Richard S on November 11, 2001 5:34 PM

Not sure about the second part, might need a macro or something. As far as the first part goes, if you enter =ROW(A12) in any cell, it will return the value 12.
HTH
Richard

Posted by Paul on November 11, 2001 6:11 PM

For the first part try =row()



Posted by Aladin Akyurek on November 11, 2001 9:48 PM

Yes, as it has already been suggested, entering in A12 the formula

=ROW()

will produce 12 as result.

If you mean by "to go to D12" fetching the value in D12, the answer is again yes:

If A1 = 12 (meaning: A1 has 12 as value), then

=INDIRECT(ADDRESS(A1,4))

will give you the value that is in D12. The formula treats the value in A1 as a row number. Note that 4 stands for column D. If you put the following formula

=COLUMN(D:D) [ or =COLUMN(D12)

in some cell, you'll get 4 as value.

I leave to the VBA folks how to move the cursor ("go to D12"), given a row number in some cell, say 12 in A1.

Aladin