## How to use the ROWS function

The ROWS function allows you to calculate the number of rows in a cell range.

The example above shows that cell range B3:B10 contains 8 rows.

#### Table of Contents

## 1. ROWS Function Syntax

ROWS(*array*)

## 2. ROWS Function Argument

array |
Required. A cell range for which you want to calculate the number of rows. |

## 3. ROWS Function Example

Formula in cell D3:

=ROWS(B3:B10)

## 4. Count rows in an array

The ROWS function also calculates the number of rows in an array.

Formula in cell B3:

=ROWS({20,95,67; 13,14,58; 96,74,28; 7,64,22})

The array has four rows. The ; (semicolon) character is a row delimiting character in an array.

## 5. Count rows based on a condition

Formula in cell E3

=ROWS(FILTER(B3:B10,B3:B10=D3))

### Explaining formula

#### Step 1 - Logical expression

B3:B10=D3

#### Step 2 - Filter values based on a condition

FILTER(B3:B10,B3:B10=D3)

#### Step 3 - Count rows

ROWS(FILTER(B3:B10,B3:B10=D3))

## 6. Count rows based on a list

Formula in cell F3:

=ROWS(FILTER(C3:C11,COUNTIF(E3:E4,C3:C11)))

### Explaining formula

#### Step 1 - Which values equals any item in the list

COUNTIF(E3:E4, C3:C11)

#### Step 2 - Filter values based on array

FILTER(C3:C11,COUNTIF(E3:E4,C3:C11))

#### Step 3 - Count rows

ROWS(FILTER(C3:C11,COUNTIF(E3:E4,C3:C11)))

## 7. Count rows in a delimited string

Excel 365 dynamic array formula in cell C3:

=ROWS(TEXTSPLIT(B3,,";"))

### Explaining formula

#### Step 1 -

TEXTSPLIT(B3,,";")

#### Step 2 -

ROWS(TEXTSPLIT(B3,,";"))

## 8. Count rows in multiple cell ranges

Formula in cell B12:

=ROWS(VSTACK(B3:B9,D3:D7,F3:F5))

### Explaining formula

#### Step 1 - Join arrays

VSTACK(B3:B9,D3:D7,F3:F5)

#### Step 2 - Calculate rows

ROWS(VSTACK(B3:B9,D3:D7,F3:F5))

### 'ROWS' Function examples

The following 91 articles have formulas containing the ROWS function.

This post explains how to lookup a value and return multiple values. No array formula required.

Rattan asks: In my workbook I have three worksheets; "Customer", "Vendor" and "Payment". In the Customer sheet I have a […]

The array formula in cell F5 returns adjacent values from column C where values in column B matches the search […]

This article demonstrates a formula that extracts values that exist only in one column out of two columns. There are […]

The image above demonstrates an array formula in cell B11 that extracts values that only exist in List 1 (B3:B7) […]

The array formula in cell B3 creates a list of dates based on the date ranges displayed in D3:E7, it […]

The array formula in cell D4 extracts the start dates for date ranges in cell range B3:B30, the array formula […]

This article demonstrates how to construct a formula that counts unique distinct values based on a condition. The image above […]

The drop down calendar in the image above uses a "calculation" sheet and a named range. You can copy the drop-down […]

This article describes how to create a drop-down list populated with sorted values from A to Z. The sorted list […]

Question: How do I create a list of dates with blanks between each quarter? (Q1, Q2, Q3 and Q4) Answer: […]

Excel has a great built-in tool for creating number series named Autofill. The tool is great, however, in some situations, […]

The image above shows an array formula in cell B3 that calculates numbers based on the numerical ranges in cell […]

Table of Contents Delete blanks and errors in a list How to find errors in a worksheet 1. Delete blanks […]

This article demonstrates how to set up dependent drop-down lists in multiple cells. The drop-down lists are populated based on […]

This article demonstrates a scoreboard, displayed to the left, that sorts contestants based on total scores and refreshes instantly each […]

The following image shows you a data set in columns B and C. The formula in cell E2 extracts a […]

Lookup with criteria and return records.

Question: I have a list and I want to filter out all rows that have a value (Column C) that […]

Sam asks: One more question for the Calendar that you have set up above can we have a excel formula […]

The array formula in cell B3 extracts overlapping dates based on the date ranges in column D and E. Array […]

This article demonstrates formulas that extract duplicate values from a column, however, column D contains values that you don't want […]

I this article I will show you how to get numerical values from a cell range manually and using an […]

Question: I second G's question: can this be done for more than 3? i.e. (Instead of last name, middle, first) […]

Table of Contents Extract shared values between two columns Extract shared values between two columns - Excel 365 Extract shared […]

The array formula in cell D3 returns the the length of longest consecutive sequence of a value in column A. Cell […]

This article demonstrates two formulas that extract distinct values from a filtered Excel Table, one formula for Excel 365 subscribers […]

The formula in cell B7 and C7 extracts whole weeks within the given date range in cell B3 and C3. […]

Array formula in D2: =INDEX($A$2:$A$21, MATCH(SMALL(IF(COUNTIF($B$2:$B$21, $B$2:$B$21)>1, COUNTIF($A$2:$A$21, "<"&$A$2:$A$21), ""),ROWS($A$1:A1)), COUNTIF($A$2:$A$21, "<"&$A$2:$A$21), 0)) Array formula in E2: =INDEX($B$2:$B$21, MATCH(SMALL(IF(COUNTIF($B$2:$B$21, $B$2:$B$21)>1, […]

This article demonstrates formulas that extract duplicates based on three conditions. Table of Contents Filter duplicate values using criteria How […]

I will in this blog post demonstrate a formula that extracts common records (shared records) from two data sets in […]

A unique value is a value that only exists once in a list. A unique distinct list contains all cell values […]

The image above shows a formula in cell D3 that extract dates from column B. Column B contains dates in […]

The formula in cell B8, shown above, extracts dates not included in the specified date ranges, in other words, dates […]

The image above demonstartes an array formula in cell B34 that extracts empty hours in a weekly calendar. I have created […]

In my previous post, I described how to build a dynamic stock chart that lets you easily adjust the date […]

This article demonstrates a formula and a VBA macro that returns every n-th row from a given cell range. The […]

This article demonstrates a formula that extracts unique values from a column also considering upper and lower characters (case sensitive). […]

Question: How do i remove common values between two lists? Answer: The solution in this article, removes common values and […]

This article describes a formula that returns all rows containing at least one digit 0 (zero) to 9. What's on […]

This article shows how to create a formula that sorts numbers from small to large excluding zeros. I will also […]

This article explains how to substitute part of a formula across all cells in a worksheet. It is easier than […]

I will in this article demonstrate three different techniques to sort a data set in Excel. The first method sorts […]

Question: How do I find missing numbers between 1-9 in a range? 1 3 4 5 6 7 8 8 […]

This blog article answers a comment in this blog article: Identify missing values in two columns using excel formula Question: […]

This article demonstrates how to use INDEX and MATCH functions to match multiple conditions and return multiple results. The Excel […]

This article demonstrates how to use INDEX and MATCH functions to lookup and return multiple results. The lookup value is […]

This article demonstrates formulas that let you perform lookups using two or more conditions. The image above shows two conditions […]

Question: I have a column "B" with a last name.. I have another columb with a date in it "C"... […]

This article demonstrates a formula that extracts values based on a condition and sorts the returned values based on values […]

This article demonstrates how to extract records/rows based on two conditions applied to two different columns, you can easily extend […]

The above image demonstrates a formula that adds values in three different columns into one column. Formula in H2: =IFERROR(INDEX($B$3:$B$7, […]

The picture above shows how to merge two columns into one list using a formula. If you are looking […]

This article demonstrates array formulas that search for cell values containing a search string and returns corresponding values on the […]

Question: I want to search two columns with two search strings? The strings can be anywhere in these two columns […]

This article demonstrates formulas that let you perform partial matches based on multiple strings and return those strings if all […]

This article demonstrates a formula that extracts a row or record from a data table using two strings as criteria. […]

Question: Can expand this equation set into more than two colums of data, say if I had a first, middle […]

This article demonstrates how to populate a drop down list with filtered values from an Excel defined Table. The animated […]

This article demonstrates formulas that rearrange values in a cell range to a single column. Table of Contents Rearrange cells […]

The picture above shows data presented in only one column (column B), this happens sometimes when you get an undesired […]

The array formula in cell B15 extracts dates from B4:B12 if it is not a duplicate item in the same […]

The image above shows a formula in cell C11 that extracts values from column D if the number in cell […]

This article demonstrates two different formulas, one for Excel 365 and one for earlier versions. Table of Contents Reverse a […]

RU asks: Can you please suggest if i want to find out the rows with fixed value in "First Name" […]

This article demonstrates array formulas that identify two search values in a row or in a sequence. The image above […]

This article explains different techniques that filter rows/records that contain a given text string in any of the cell values […]

I will in this article demonstrate how to search a table for a date based on a condition and then […]

Question: Hi, The formula here works great but I can't figure out how to change it to work with data […]

Geoff asks: Hi Oscar, I have a cross reference table we use for shift scheduling. The x-axis is comprised of […]

This article demonstrates how to extract multiple numbers based on a condition and return a sorted list from small to […]

This article demonstrates how to sort numbers from small to large using a condition or criteria, I will show how […]

This article demonstrates a formula that sorts text values based on character length, the Excel 365 dynamic array formula is […]

This article demonstrates ways to sort numbers from smallest to largest ignoring duplicate numbers. Table of Contents SMALL function with […]

Today I learned how to sort numbers from multiple cell ranges thanks to Sam Miller. It is surprisingly simple and easy. […]

Question: How do I sort a range alphabetically using excel array formula? Answer: Cell range $B$2:$E$5 contains text values in random […]

Andre asks:I am trying to list people with the highest scores based on certain criteria. My data: column A B […]

In this article, I will demonstrate two techniques for counting per row. The first example is simple and straightforward. The […]

This article demonstrates how to sort a data set by multipe columns using the SORTBY function, Ecel Table and Excel […]

Array formula in D5: =SMALL(IF(($B$3:$B$12<=$E$3)*($B$3:$B$12>=$E$2), $B$3:$B$12, "A"), ROWS($A$1:A1)) How to create an array formula Copy array formula Select cell D5 […]

Ralee asks in in this blog post: Sort values in parallel (array formula) If there is information in adjacent columns, […]

Table of Contents Sort text from two columns combined (array formula) How to create an array formula How to copy […]

Array formula in B2: =INDEX($B$3:$B$20, MATCH(LARGE(LEN($B$3:$B$20), ROWS($A$1:A1)), LEN($B$3:$B$20)*(COUNTIF($F$2:F2, $B$3:$B$20)<COUNTIF($B$3:$B$20, $B$3:$B$20)), 0)) copied down as far as needed. To enter an […]

The image above shows a table with two columns in cell range B3:C16, it contains random text values in column […]

This article describes a formula that sorts values arranged in a column from A to z by every other value. […]

Question: How do I divide values equally into groups (3 lists or less)? This post shows you two different approaches, […]

Mark G asks in Create a random playlist in excel: Can this example be modified to create a true round-robin […]

This article demonstrates how to extract multiple values based on a search value and display them sorted from A to […]

This post describes how to search filtered values in an Excel defined Table using a condition given in cell 12 and return […]

VLOOKUP and return multiple matches based on many criteria.

Question: How to filter out data from List 1 that is missing in list 2? Answer: This formula is useful […]

### Functions in 'Lookup and reference' category

The ROWS function function is one of many functions in the 'Lookup and reference' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form