How to Use VLOOKUP for Rows in Excel (With Alternatives)

Method 1 – Use the MATCH function to Define a Column Number from Rows in VLOOKUP

In the following picture, a dataset is presented with the amounts of sales of several salespersons over consecutive six months in a year. We’ll use the VLOOKUP function here to extract the sales value of a salesman in a specified month. We can use the MATCH function to define the column number for the specified month in E14 from the month headers.

Use of MATCH function to Define Column Number from Rows in VLOOKUP

  • In the output Cell E15, the required formula will be:
=VLOOKUP(E13,B5:H11,MATCH(E14,B4:H4,0),FALSE)
  • Press Enter and you’ll get the sales value of Jordan in April at once.

Use of MATCH function to Define Column Number from Rows in VLOOKUP

The MATCH function defines the column number for the VLOOKUP function. The VLOOKUP function then uses this column number to extract data based on the specified month from the month headers.


Method 2 – Use Multiple Rows with the VLOOKUP Function in Excel

Let’s use the comparative sales values over three fixed months in two different years. We’re going to extract the sales value of Jordan in the month of February 2021, which are values in E14, E15, and E16.

Use of Multiple Rows with VLOOKUP Function in Excel

The required formula in cell E17 will be:

=VLOOKUP(E14,B6:H12,MATCH(E16&E15,C4:H4&C5:H5,0)+1,FALSE)

Use of Multiple Rows with VLOOKUP Function in Excel

How Does the Formula Work?

  • The use of Ampersand (&) joins the selected month and year from the Cells E15 and E16.
  • The lookup array in the MATCH function has been defined by an array of pairs containing all years and months joined by the Ampersand (&).
  • In the lookup array of the MATCH function, the two ranges of cells have been selected starting from Column C. So, by adding ‘1’ to the MATCH function in the third argument of the VLOOKUP function, the formula will consider the index of the return column number based on the entire array of B6:H12.

Method 3 – Combining VLOOKUP with the Column Function to Return an Entire Row

Let’s use the starting dataset and fetch the sales values of a specified salesperson in C13 for all months available in the dataset.

Combining VLOOKUP with Column Function to Return an Entire Row

Steps:

  • Select the output cell C14 and insert the following formula:
=VLOOKUP($C$13,$B$5:$H$11,COLUMN(A1)+1,FALSE)
  • Press Enter and you’ll get the sales value for Jordan in January.

Combining VLOOKUP with Column Function to Return an Entire Row

  • Use the Fill Handle from cell C14 to autofill Row 14.

Combining VLOOKUP with Column Function to Return an Entire Row

The COLUMN function has been used to alter the column numbers serially in the third argument of the VLOOKUP function while autofilling the 14th row.


Method 4 – Including an Array Formula in VLOOKUP to Extract Rows in Excel

If you want to get all the sales data for a salesperson with a single formula, use an array formula in C14 to define the column numbers in the VLOOKUP function:

=VLOOKUP(C13,B5:H11,{2,3,4,5,6,7},FALSE)

Applying an Array Formula in VLOOKUP to Extract Rows in Excel

The column numbers have been defined with an array containing the index numbers of the return columns: {2,3,4,5,6,7}. The VLOOKUP function returns the outputs from these specified columns for the specified salesperson.


Two Alternatives to the VLOOKUP While Looking for Rows

Alternative 1 – Use the HLOOKUP Function to Look for Rows in Excel

The HLOOKUP function looks for a value in the top row of a table or array of values and returns the value in the same column from the specified row. The generic formula of the HLOOKUP function is:

=HLOOKLUP(lookup_value, table_array, row_index_num, [range_lookup])

Since we’re looking for the sales value of Jordan in the month of April, the required formula in Cell E15 will be:

=HLOOKUP(E14,B4:H11,MATCH(E13,B4:B11,0),FALSE)

Use of HLOOKUP Function to Look for Rows in Excel

The MATCH function defines the row number of the specified salesperson in Column B.

Read More: VLOOKUP from Multiple Columns with Only One Return in Excel


Alternative 2 – Use the INDEX-MATCH Formula to Lookup Along Columns and Rows

The generic formula of this INDEX function is:

=INDEX(array, row_numer, [column_numer])

OR

=INDEX(reference, row_num, [column_num], [area_num])

We can specify the row and column numbers of the INDEX function for a particular salesman in a particular month to extract the corresponding sales value.

The required formula in the output Cell E15 will be:

=INDEX(B5:H11,MATCH(E13,B5:B11,0),MATCH(E14,B4:H4,0))

Use of INDEX-MATCH Formula to Lookup Along Columns and Rows


Download the Practice Workbook


You May Also Like to Explore


<< Go Back to VLOOKUP a Range | Excel VLOOKUP Function | Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Nehad Ulfat
Nehad Ulfat

NEHAD ULFAT is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET but switched gears, working as a content developer.  In this role, he creates techy content all about Excel... Read Full Bio

2 Comments
  1. Want something similar to your:
    2. Use of INDEX-MATCH Formula to Lookup Along Columns and Rows
    https://www.exceldemy.com/vlookup-for-rows-in-excel/
    INDEX(B5:H11,MATCH(E13,B5:B11,0),MATCH(E14,B4:H4,0))

    My application:
    INDEX(A20:G197,MATCH(A206,A20:G197,0),then whatever matches A206, I want the numerical value in that row’s column H)

    • Reply Bishawajit Chakraborty
      Bishawajit Chakraborty Dec 17, 2022 at 11:51 PM

      Thank you, Edward Vinieratos, for your comment. According to your formula, your data seems quite large. It is hard to identify where the error lies. Can you please kindly share your excel file with us? We will create another Excel file with your desired result. We will reply to you back as soon as possible. Email Address: [email protected].

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo