In this article, we will learn about how to Get Relative Column index in excel.
For instance, we have 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 Column of the worksheet. So we will use the Column function and a simple logic to get the column Index in the data. Let's get some understanding for the Column function first.
The Column function returns the Column number of the cell or the cell reference. It returns a number for the given cell reference.
Syntax:
Note: If no argument is given to the function. Then the function returns the Column 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 Column functions. Then for the rest of the table we just be extending the same formula till the last Column of the data.
Generic formula:
Explanation:
Let’s understand this function using it in an example.
Here we have a data_table with names and
We need to mark each column with its index in the given Index Row.
Use the customized formula in the D2 cell:
Explanation:
$ sign returns the relative cell reference which is used to fix the cell reference.
The formula will look like as shown in the snapshot above. Click Enter to get the result.
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 + R shortcut key or drag right feature of 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 Column 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.
Related Articles
How to use the COLUMN function in Excel
How to use the COLUMNS function in Excel
How to Remove Text in Excel Starting From a Position
Create drop down list in excel with colour
Remove leading and trailing spaces from text in Excel
Popular Articles
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.