In this article, we will learn about how to Get Relative ROW index in excel.
For instance, we have a data and we need to mark the index for the data having index column. But the problem is that the data doesn't start from the 1st row of the worksheet. So we will use the ROW function and a simple logic to get the Index for the data. Let's get some understanding for the ROW function first.
The ROW function returns the row number of the cell or the cell reference. It returns a number for the given cell reference.
Note: If no argument is given to the function. Then the function returns the row number for the cell where formula is used.
Now we will construct a formula using the above explained function and a simple logic. Firstly, we need to get the first index which is 1. So we need to create a difference of 1 between 2 numbers. These two numbers will be the outcome of two ROW functions. Then for the rest of the table we just be extending the same formula till the last row of the data.
Use the formula:
|= ROW() - ROW(1 - Row())|
Let’s understand this function using it in an example.
Here we have a data_table with an INDEX column with it.
We need to fill the INDEX column using the below formula
Use the formula in the C7 cell:
|= ROW( ) - ROW ( $C$6 )|
As you can see in the above snapshot that the formula returns 1 as the first INDEX for the table. Copy the formula to the rest of the cells using the Ctrl + D shortcut key or drag down option in excel.
As you can see from the above snapshot that the index column is filled with values as required.
There's a new and easy method to the same. In Excel 2016, it automatically extends the values just by the drag down option. Follow the steps to see how it is used.
As you can see in the gif above that the INDEX column is done.
Hope you understood how to Get Relative ROW index in Excel. Explore more articles on Excel cell reference function here. Please feel free to state your query or feedback for the above article.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.