How to Drag a Formula Horizontally with Vertical Reference in Excel

We have a dataset, Sales Report of Fruit, which shows Product ID, Sales Rep, Fruits, States, and Sales. We will show you how to drag the formula horizontally with vertical reference.

Dataset


Method 1 – Using the COLUMN Function with VLOOKUP

Steps:

  • Enter the following formula in cell C15:

=VLOOKUP($B$15,$B$5:$E$12,COLUMN(C$4)-1,FALSE)

Here, $B$15 is the lookup value, $B$5:$E$12 is the table_array argument, C$4 refers to the Sales Rep heading of column C, and FALSE is for the exact matching.

⧬ Formula Explanation:

  • In the above formula, the COLUMN(C$4) syntax returns column number as 3 but you need to subtract 1 as the Sales Rep column is located at the 2nd position with respect to the lookup column (Product ID).
  • Later, the VLOOKUP portion finds the relevant Sales Rep.

Excel Drag Formula Horizontally with Vertical Reference Using COLUMN Function with VLOOKUP

  • Press ENTER and you’ll get the output as James.
  • Drag the formula horizontally to pull out the other data for the specified Product ID.

Excel Drag Formula Horizontally with Vertical Reference Using COLUMN Function with VLOOKUP

  • The output will look as follows.

Excel Drag Formula Horizontally with Vertical Reference Using COLUMN Function with VLOOKUP

Read More: Excel Fill Down to Next Value


Method 2 – Using the INDEX Function 

In the updated dataset, we used 1002 Product ID multiple times to extract the corresponding Sales Rep from different rows.

Utilizing ROW and COLUMN Functions with INDEX FunctionSteps:

  • Enter the following formula:

=INDEX($C$5:$C$12, SMALL(IF($B$15=$B$5:$B$12,ROW($B$5:$B$12)-ROW($B$5)+1), COLUMN(A1)))

Here, $B$5 refers to the starting cell of Product ID, $C$5:$C$12 is the cell range representing Sales Rep, and $B$5:$B$12 cells denotes Product ID.

⧬ Formula Explanation:

  • The ROW function mainly finds the row number from a given range of datasets. Here, ROW($B$5:$B$12)-ROW($B$5)+1 returns the row number of the $B$5:$B$12 cells used as the 2nd argument of the IF logical function.
  • Then, the IF($B$15=$B$5:$B$12, ROW($B$5:$B$12)-ROW($B$5)+1) executes searching to find the 1002 Product ID. When the formula matches, it returns TRUE, else it returns FALSE.
  • The SMALL function finds the smallest value in a given dataset. Here, the function returns the lowest row number assigned as the row_num argument in the INDEX function.
  • Lastly, the INDEX function extracts the first Sales Rep for 1002 Product ID.

Excel Drag Formula Horizontally with Vertical Reference Utilizing ROW and COLUMN Functions with INDEX Function

  • Drag the formula horizontally to get the rest of the Sales Rep of the 1002 Product ID.

Excel Drag Formula Horizontally with Vertical Reference Utilizing ROW and COLUMN Functions with INDEX Function

You’ll get the following output.

Excel Drag Formula Horizontally with Vertical Reference Utilizing ROW and COLUMN Functions with INDEX Function

Read More: How to Drag Formula and Ignore Hidden Cells in Excel


Method 3 – Applying ROW and COLUMN Functions with MIN Function

Steps:

  • Enter the following formula:

=INDEX($C$5:$C$12, SMALL(IF($C$14=$B$5:$B$12, ROW($B$5:$B$12)-MIN(ROW($B$5:$B$12))+1, ""), COLUMN(A1)))

Here, the MIN function returns the lowest row number from the given $B$5:$B$12 cells. The rest work similarly, as discussed in the earlier method.

Applying ROW and COLUMN Functions with MIN Function

  • Drag the formula horizontally.

Excel Drag Formula Horizontally with Vertical Reference Applying ROW and COLUMN Functions with MIN Function

You’ll get the following output.

Excel Drag Formula Horizontally with Vertical Reference Applying ROW and COLUMN Functions with MIN Function

Read More: How to Fill Formula Down to Specific Row in Excel


Download the Practice Workbook


Related Articles


<< Go Back to Fill Handle in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Abdul Kader
Md. Abdul Kader

MD. ABDUL KADER is an engineer with a talent for Excel and a passion for VBA programming. To him, programming is like a time-saving wizard, making data manipulation, file handling, and internet interactions a breeze. His skill set extends to SWM, GIS, RS, and SPSS. He holds a B.Sc in Urban & Regional Planning from Chittagong University of Engineering and Technology and has shifted to become a content developer. In this role, he crafts technical content centred around... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo