Excel ROW Function

The Excel ROW function returns the first row number of the selected reference

Example: Excel ROW Function

Excel ROW Function

METHOD 1. Excel ROW Function

EXCEL

=ROW()
Result in cell B5 (5) - returns the row number of the cell that the formula is written in.

=ROW(E9)
Result in cell B6 (9) - returns the row number of row 9.

=ROW(E3:G7)
Result in cell B7 (3) - returns the row number of the first cell in the selected range, being row 3.

=ROW(Row_Defined_Name)
Result in cell B8 (10) - returns the row number of the Row_Defined_Name defined name that comprises cell E10.

METHOD 2. Excel ROW function using the Excel built-in function library

EXCEL

Formulas tab > Function Library group > Lookup & Reference > ROW > populate the input box

=ROW(E9)
Note: in this example we are populating the Reference input box with a single cell reference.
Built-in Excel ROW Function

METHOD 1. Excel ROW function using VBA

VBA

Sub Excel_ROW_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("ROW")
'apply the Excel ROW function
ws.Range("B5") = ws.Range("B5").Row
ws.Range("B6") = ws.Range("E9").Row
ws.Range("B7") = ws.Range("E3:G7").Row

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named ROW.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("B5"), ("B6") and ("B7") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

Usage of the Excel ROW function and formula syntax

EXPLANATION

DESCRIPTION
The Excel ROW function returns the first row number of the selected reference.
SYNTAX
=ROW([reference])
ARGUMENTS
reference: (Optional) A cell or range of cells for which you want the value returned.

ADDITIONAL NOTES
Note 1:If you do not provide a reference the ROW function will return the row number of the cell in which you have entered the formula.