Go Back

Excel ROWS Function

We can use the Excel ROWS function to count the number of rows in a specified array or reference. In easy steps, we will walk through the process of checking an array reference and count the number of rows in that reference.

Figure 1: Results of using the Excel ROWS function

General Formula

=ROWS(array)

Formula

=ROWS(A5)

Setting up the Data

  • We will set up a hypothetical list of arrays called Formula in column B
  • Convert formula to text to see only the formula by right clicking on the cell and selecting “format text”.
  • Column C will contain our results after we input the array formula extracted from each cell in Column B

Figure 2: Setting up the Data

Using the Excel ROWS function

  • We will click on Cell C4 and enter the array as displayed in Cell B4.
    =ROWS(A5)
  • We will press the enter key

Figure 3: Applying the ROWS function

  • Next, we will select Cell C5
  • We will enter the array displayed in Cell B5 into Cell C5
    =ROWS(A3:A9)
  • We will press the enter key

Figure 4: Applying the ROWS function

  • We will follow the steps above to find the results for the remaining cells.

Figure 5: Results of using the Excel ROWS function

Explanation

The Excel ROWS Function will count the number of rows in the given reference. For instance, the Cell B5 contains ROWS(A3:A9), when we apply the ROWS function to this cell, it will return with seven because the range contains seven rows.

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

Yellow Rows means Billed Green Rows means Paid I need all yellow and green duplicate rows to be separated and I need to just review the Yellow Rows with NO corresponding Green Row and the Green Rows with no corresponding Yellow Row
Solved by K. C. in 23 mins
I am trying to plot data from 2 different rows on the same graph. The rows are not consecutive. How do I highlight each of these rows while skipping the data in the rows between them?
Solved by C. U. in 22 mins
I have a macro that allows me to choose the size of a table for inputting data, but now everytime I try to add data into a cell the workbook refreshes and takes me to the end of the document. The following is my code: Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Select Case Range("C15") Case "Select" Application.Rows("1:1000").Select Application.Selection.EntireRow.Hidden = False Rows("18:318").Select Selection.EntireRow.Hidden = True Case "5x3" Application.Rows("1:1000").Select Application.Selection.EntireRow.Hidden = False Rows("22:35").Select Selection.EntireRow.Hidden = True Rows("42:55").Select Selection.EntireRow.Hidden = True Rows("62:318").Select Selection.EntireRow.Hidden = True Case "10x3" Application.Rows("1:1000").Select Application.Selection.EntireRow.Hidden = False Rows("22:35").Select Selection.EntireRow.Hidden = True Rows("42:55").Select Selection.EntireRow.Hidden = True Rows("62:75").Select Selection.EntireRow.Hidden = True Rows("82:95").Select Selection.EntireRow.Hidden = True Rows("102:115").Select Selection.EntireRow.Hidden = True Rows("119:318").Select Selection.EntireRow.Hidden = True Case "15x3" Application.Rows("1:1000").Select Application.Selection.EntireRow.Hidden = False Rows("22:35").Select Selection.EntireRow.Hidden = True Rows("42:55").Select Selection.EntireRow.Hidden = True Rows("62:75").Select Selection.EntireRow.Hidden = True Rows("82:95").Select Selection.EntireRow.Hidden = True Rows("102:115").Select Selection.EntireRow.Hidden = True Rows("122:135").Select Selection.EntireRow.Hidden = True Rows("142:155").Select Selection.EntireRow.Hidden = True Rows("162:318").Select Selection.EntireRow.Hidden = True Case "20x3" Application.Rows("1:1000").Select Application.Selection.EntireRow.Hidden = False Rows("22:35").Select Selection.EntireRow.Hidden = True Rows("42:55").Select Selection.EntireRow.Hidden = True Rows("62:75").Select Selection.EntireRow.Hidden = True Rows("82:95").Select Selection.EntireRow.Hidden = True Rows("102:115").Select Selection.EntireRow.Hidden = True Rows("122:135").Select Selection.EntireRow.Hidden = True Rows("142:155").Select Selection.EntireRow.Hidden = True Rows("162:175").Select Selection.EntireRow.Hidden = True Rows("182:195").Select Selection.EntireRow.Hidden = True Rows("202:215").Select Selection.EntireRow.Hidden = True Rows("219:318").Select Selection.EntireRow.Hidden = True Case "30x3" Application.Rows("1:1000").Select Application.Selection.EntireRow.Hidden = False Rows("22:35").Select Selection.EntireRow.Hidden = True Rows("42:55").Select Selection.EntireRow.Hidden = True Rows("62:75").Select Selection.EntireRow.Hidden = True Rows("82:95").Select Selection.EntireRow.Hidden = True Rows("102:115").Select Selection.EntireRow.Hidden = True Rows("122:135").Select Selection.EntireRow.Hidden = True Rows("142:155").Select Selection.EntireRow.Hidden = True Rows("162:175").Select Selection.EntireRow.Hidden = True Rows("182:195").Select Selection.EntireRow.Hidden = True Rows("202:215").Select Selection.EntireRow.Hidden = True Rows("222:235").Select Selection.EntireRow.Hidden = True Rows("242:255").Select Selection.EntireRow.Hidden = True Rows("262:275").Select Selection.EntireRow.Hidden = True Rows("282:295").Select Selection.EntireRow.Hidden = True Rows("302:315").Select Selection.EntireRow.Hidden = True Case "10x10" Application.Rows("1:1000").Select Application.Selection.EntireRow.Hidden = False Rows("119:318").Select Selection.EntireRow.Hidden = True End Select End Sub
Solved by I. H. in 24 mins

Leave a Comment

avatar