Excel - ROWS Function



ROWS Function

The Excel ROWS function retrieves the total number of rows in a cell reference or array. It is part of the Lookup and Reference function. More straightforwardly, you can say how many rows exist in the given array or cell range. It is merely different from the ROW function that extracts the row number of all the cells of a given reference. The size of the dataset is easily determined when importing the dataset from the web through the ROWS function.

Compatibility

This advanced Excel function is compatible with the following versions of MS Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013
  • Excel 2010
  • Excel 2007

Syntax

The syntax of the ROWS function is as follows −

=ROWS(array)

Arguments

You can use the following arguments with the ROWS function −

Argument Description Required / Optional
Array An array, an array formula, or a reference to a range of cells for which you want the number of rows. Required

Examples of ROWS Function

Practice the following examples to learn the use of the ROWS function in Excel.

Example 1: How to utilize the ROWS Function in Excel?

Implementation of the ROWS function where different cell ranges are to be supplied as an argument to get to know their total row number.

Solution

Step 1 − First, open a new worksheet and enter the formula =ROWS(B:B) in the B3 cell.

How to utilize the ROWS Function in Excel1

After that, press the Enter tab to obtain the result.

How to utilize the ROWS Function in Excel2

Therefore, the number of rows retrieved by the ROWS function is 1048576.

Step 2 − After that, enter the formula =ROWS(D2:E15) in the B4 cell.

How to utilize the ROWS Function in Excel3

Moreover, hit the Enter tab to execute the ROWS function in Excel. Therefore, the total number of rows is 14.

Step 3 − Afterward, double-click on the B5 cell and type the formula =ROWS(D2:D6).

How to utilize the ROWS Function in Excel4

After pressing the Enter tab, the ROWS function returns the total number of 5 rows.

How to utilize the ROWS Function in Excel5

Example 2: Assigning the Distinct IDs for Cyber Security Events using the ROWS Function

In this example, suppose you are a cyber analyst and actively host different Cyber Security events on various dates and in different time zones. You must assign the distinct IDs for the upcoming cyber events through the ROWS function.

Solution

Step 1 − First, select the cell A2 and write the expression ="Upcoming Event " & ROWS($A$2:A2). This expression combines the text string "Upcoming Event" with the ROWS function using the & operator. The range ($A$2:A2) is specified as an argument that means the starting and ending cell ranges are the same. Hence, the expression "ROWS($A$2:A2)" retrieves the row number 1.

Assigning Distinct IDs for Cyber Security Events1

After that, hit Enter to get the resulting value.

Assigning Distinct IDs for Cyber Security Events2

Step 2 − Furthermore, select the A2 cell, drag the + sign at the bottom right corner of it, and place it into the A8 cell to evaluate the same formula for the remaining cells.

Assigning Distinct IDs for Cyber Security Events3

Download Practice Sheet

You can download and use the sample data sheet to practice the ROWS function.

Advertisements