Lookup & reference function

ROWS function

Counts the number of rows in a range or array.

Available in All versions of Excel, including Microsoft 365, Excel for the web and Excel for Mac

In every Excel versionWorks in Google Sheets

Syntax

ROWS(array)
ArgumentWhat it means
arrayRequiredA range, array constant, or formula that returns an array (such as FILTER or UNIQUE).

Returns: A whole number: how many rows tall array is.

How ROWS works

ROWS measures how tall a range or array is. =ROWS(A2:C5) returns 4, whether the cells are full or empty. It is the vertical counterpart of COLUMNS.

In modern Excel ROWS has become a favourite companion of dynamic-array functions: wrap it around FILTER to count how many records meet a condition, or around UNIQUE to count distinct values. Because it measures the result's size, it counts everything the inner formula returns - including the single #CALC! or fallback row a FILTER returns when nothing matches, so handle that case separately.

Examples

1Number of products in a range

E2fx=ROWS(A2:C5)
ABCDE
1CodeProductPrice
2P-101Keyboard254
3P-102Mouse12
4P-103Monitor149
5P-104Webcam39

Result: 4

The range covers rows 2 to 5: four products.

2Count distinct departments

E2fx=ROWS(UNIQUE(C2:C5))
ABCDE
1Emp IDNameDepartment
21001Maria LopezSales3
31002Tom BeckerFinance
41003Aisha KhanIT
51004Luca RossiSales

Result: 3

UNIQUE returns Sales, Finance and IT (Sales appears twice in the data), and ROWS counts them.

3Count matching records

G2fx=ROWS(FILTER(A2:E8, B2:B8="North"))
ABCDEFG
1RepRegionProductUnitsRevenue
2AnaNorthLaptop436003
3BenSouthMonitor101490
4ChloeNorthMonitor6894
5AnaEastLaptop21800
6DevSouthLaptop54500
7BenEastMouse30360
8ChloeNorthMouse12144

Result: 3

FILTER returns the three North rows and ROWS counts them.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 17 KB

Common errors and how to fix them

ErrorWhy it happensFix
#CALC!The inner FILTER found nothing and has no if_empty value.Use =IFERROR(ROWS(FILTER(...)), 0) or COUNTIFS for simple counts.

Tips

  • =ROWS($A$2:A2) copied down produces a running count 1, 2, 3...
  • To count only non-blank cells use COUNTA; ROWS counts blanks too.

Google Sheets

ROWS also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

ROWS in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
CzechŘÁDKY
DanishRÆKKER
DutchRIJEN
FinnishRIVIT
FrenchLIGNES
GermanZEILEN
HungarianSOROK
ItalianRIGHE
Norwegian (Bokmål)RADER
PolishILE.WIERSZY
Portuguese (Brazil)LINS
Portuguese (Portugal)LINS
RussianЧСТРОК
SpanishFILAS
SwedishRADER
TurkishSATIRSAY

Recipes that use ROWS