Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel select a value from a cell having row number calculated

In column A i have numbers calculated like so:

[A]
[1]
[2]
[3]
[4]
[1]
[2]
[3]
...

In column K I have values:

[row] [K]
[ 1 ] [7]
[ 2 ] [3]
[ 3 ] [6]
[ 4 ] [9]

How could I pull values from column K given that row number is the number stored in column A?
I have tried using Address() and Cell() like so:

=Cell("contents",ADDRESS(A5,11))

ADDRESS supposed to return a reference to given cell provided row and column numbers (that can be taken from other cells), CELL supposed to take reference and return detail about the cell referenced (here "content" and thus value). If I use it like so:

=Cell("contents", K4)

it gives me '9', when I use ADDRESS:

=ADDRESS(A4,11)

it gives me $K$4. But when I use them together I get an error.

like image 971
Daniel Gruszczyk Avatar asked Nov 29 '13 10:11

Daniel Gruszczyk


People also ask

How do I return a row number to a value in Excel?

Use the ROW function to number rows In the first cell of the range that you want to number, type =ROW(A1). The ROW function returns the number of the row that you reference. For example, =ROW(A1) returns the number 1.

How do I select certain rows in Excel based on a cell value?

To select rows based on cell value: In the Grid view of an open table or worksheet, right-click the cell on which you want to base the row selection and point to Quick select where. The Trillion-Row Spreadsheet displays a list of selection options. Click the desired selection option.

How do I extract specific data from a cell in Excel?

=LEFT(B1,2) to extract the first 2 characters of the cell B1. =RIGHT(B1,8) to extract the last 8 characters of the cell B1. =MID(B1,4,2) to extract the 2 characters following the 4th character in B1. To apply the changes to the cells below, drag down the blue square.

How do I find cell value based on row and column ID in Excel?

=INDEX() returns the value of a cell in a table based on the column and row number. =MATCH() returns the position of a cell in a row or column. Combined, the two formulas can look up and return the value of a cell in a table based on vertical and horizontal criteria.


1 Answers

You could use the INDIRECT function. This takes a string and converts it into a range

More info here

=INDIRECT("K"&A2)

But it's preferable to use INDEX as it is less volatile.

=INDEX(K:K,A2)

This returns a value or the reference to a value from within a table or range

More info here

Put either function into cell B2 and fill down.

like image 56
Sam Avatar answered Oct 27 '22 14:10

Sam