ROWS in Excel counts the rows in a range
=ROWS(array) returns the number of rows in a range or array. =ROWS(A2:A100) returns 99, and empty cells are included.
=ROWS(array)The ROWS formula in Excel is =ROWS(array). It returns an integer: the number of rows in that range or array. =ROWS(A2:A100) returns 99. =ROWS(A1:C10) returns 10, not 30, because the range has 10 rows and 3 columns. Empty cells, hidden rows, and rows hidden by a filter are all counted. =ROWS(A:A) returns 1048576 in Excel 2007 and later. COUNTA counts cells that are not empty. ROW returns the row number of one reference, not a count. ROWS takes a single argument. A quoted address such as =ROWS("A1:A10") returns #VALUE!.
Syntax & Parameters
The syntax is =ROWS(array). array is the only argument: a range or an array, such as A1:A10, B2:D15, a named range, or a whole column such as A:A. ROWS does not take a second argument, and it does not accept a list of separate areas written as extra arguments. ROWS counts every row in the reference, including empty, hidden, and filtered rows. =ROWS(A1:A100) returns 100 even when some cells are blank. =ROWS(A1:C10) returns 10, because the range has 10 rows, not 30 cells. =ROWS(A:A) returns 1048576 in Excel 2007 and later. To count cells that are not empty, use COUNTA. ROW returns a row number, not a count. =ROWS("A1:A10") returns #VALUE! because the argument is text, not a reference.
arrayPractical Examples
Counting Inventory Row Count
=ROWS(A2:A501)This formula counts all rows in the inventory range from A2 to A501, excluding the header row. It returns 500, indicating 500 product entries are present in the inventory list. This helps the manager quickly verify that all expected SKUs have been entered.
Count rows, not cells
=ROWS(A1:C10)A1:C10 has 10 rows and 3 columns, so it contains 30 cells. ROWS counts rows only, and returns 10.
Blank cells still count
=ROWS(C3:C999)C3 through C999 is 997 rows. ROWS returns 997 even when every cell in the range is blank.
Key Takeaways
- ROWS counts the number of rows in a range regardless of cell contents, making it ideal for structural calculations and dynamic formulas
- The function returns an integer representing total rows and works with any range reference, including entire columns and named ranges
- Distinguish between ROWS (structural count) and COUNTA (data count) to choose the right function for your analysis needs
- Combine ROWS with other functions like SUM, IF, OFFSET, and INDIRECT to build sophisticated dynamic spreadsheets that scale automatically
- ROWS is compatible with all Excel versions from 2007 onwards and works consistently across Excel, Google Sheets, and LibreOffice
Pro Tips
Use named ranges with ROWS for cleaner, more maintainable formulas. Instead of =ROWS(A1:A1000), create a named range 'SalesData' and use =ROWS(SalesData). This makes formulas self-documenting and easier to update.
Impact : Significantly improves spreadsheet readability and reduces errors when ranges need updating. Team members can understand formulas at a glance without decoding cell references.
Combine ROWS with INDIRECT to create truly dynamic formulas that adapt to user input. For example, =ROWS(INDIRECT("A1:A"&A1)) counts rows based on a number entered in cell A1, enabling user-controlled formula behavior.
Impact : Enables sophisticated interactive spreadsheets where formulas respond to user parameters, perfect for dashboards and decision-support tools.
Remember that ROWS counts structural dimensions, not data quality. Always validate your data separately using COUNTA or COUNTIF to ensure you're working with actual values, not just empty row structures.
Impact : Prevents logical errors in your analysis and ensures your formulas accurately reflect data reality rather than making assumptions based on range size alone.
Use ROWS in combination with SUMPRODUCT for advanced filtering scenarios: =SUMPRODUCT((B1:B100>100)*(ROWS(B1:B100))). This counts rows meeting specific criteria rather than just total rows.
Impact : Provides sophisticated data analysis capabilities, allowing you to count rows conditionally based on multiple criteria without requiring helper columns.
Useful Combinations
Dynamic Averaging with ROWS
=SUM(A1:A100)/ROWS(A1:A100)This combination calculates the average of a range by dividing the sum by the row count. It's more flexible than AVERAGE because it adapts if you change the range, making it ideal for dynamic reports that need to scale with data growth.
Conditional Row Counting with IF and ROWS
=IF(ROWS(A:A)>1000,"Large Dataset","Small Dataset")This formula classifies your dataset size by checking if the row count exceeds a threshold. It's useful for triggering different processing logic based on data volume, such as using different analysis methods for large versus small datasets.
Dynamic Range Creation with ROWS and OFFSET
=SUM(OFFSET(A1,0,0,ROWS(A:A)-1,1))This advanced combination creates a dynamic sum that automatically adjusts based on the number of rows in column A. The OFFSET function uses ROWS to determine how many rows to include, creating a self-adjusting formula that requires no manual updates.
Common Errors
Cause: The argument is text, or it is not a single range. =ROWS("A1:A10") returns #VALUE! because the address is in quotes. ROWS also returns #VALUE! when a second argument is supplied.
Solution: Pass one range or array, without quotes: =ROWS(A1:A10). Do not add a second range inside the same ROWS call.
Cause: The function name is misspelled or Excel doesn't recognize the formula, often occurring when typing 'ROW' instead of 'ROWS' or using incorrect function syntax.
Solution: Double-check the function spelling, it must be 'ROWS' (plural). Ensure the formula begins with an equals sign (=). Verify that your Excel version supports this function (all versions from 2007+ support ROWS). Check for extra spaces or special characters in the formula.
Cause: The referenced range has been deleted, moved, or the workbook containing the range is no longer available, breaking the formula's reference.
Solution: Verify that the range you're referencing still exists in your workbook. If you've deleted columns or rows, update the formula with the correct range. If referencing another workbook, ensure that workbook remains open or properly linked. Use named ranges to create more stable references that adjust automatically.
Troubleshooting Checklist
- 1.Verify that your range reference uses correct syntax with colons (A1:A10) not commas or other separators
- 2.Confirm the range exists and hasn't been deleted; check for #REF! errors indicating broken references
- 3.Ensure the formula begins with = and that ROWS is spelled correctly (plural form, not ROW)
- 4.Test whether you need ROWS (structural count) or COUNTA (data count) for your specific business requirement
- 5.Check if your range includes headers and adjust calculations accordingly (subtract 1 if needed for data rows only)
- 6.Verify Excel version compatibility; while ROWS works in all modern versions, ensure your file format supports it
Edge Cases
Using ROWS with entire column references (e.g., =ROWS(A:A))
Behavior: Returns 1048576, the number of rows on a worksheet in Excel 2007 and later.
Solution: Specify exact ranges like A1:A1000 instead of entire columns to get meaningful results that reflect your actual data scope
Using entire column references can impact performance in large spreadsheets; avoid this practice in production files
Applying ROWS to a single cell (e.g., =ROWS(A1))
Behavior: Returns 1 because a single cell technically occupies one row, even if it's empty or contains text
Solution: Use this for validation logic, such as =IF(ROWS(A1)=1,"Single Cell","Range") to confirm you're working with the expected range size
This edge case is rarely needed but demonstrates that ROWS measures dimensions rather than content
Combining ROWS with filtered or hidden rows
Behavior: ROWS counts all rows in the range including hidden and filtered rows; it doesn't distinguish between visible and invisible rows
Solution: Use SUBTOTAL function instead if you need to count only visible rows: =SUBTOTAL(3,A1:A100) counts non-empty visible cells
This is important when working with auto-filtered tables where you need to exclude hidden data from calculations
Limitations
- •ROWS counts structural rows in a range, not data-containing cells. If you need to count only cells with actual values, use COUNTA or COUNTIF instead.
- •ROWS cannot distinguish between visible and hidden rows, both are counted equally. Use SUBTOTAL for filtered data analysis where row visibility matters.
- •The function only works with rectangular ranges; complex multi-area selections may behave unpredictably depending on Excel version and syntax used.
- •ROWS returns the same value regardless of data quality or cell contents. Always validate data separately to ensure your analysis reflects actual information rather than assumed data distribution.
Alternatives
Compatibility
✓ Excel
Since Excel 2007
=ROWS(array) - Identical syntax across Excel 2007, 2010, 2013, 2016, 2019, and Excel 365✓Google Sheets
=ROWS(array) - Fully compatible with Google Sheets using identical syntaxGoogle Sheets supports ROWS with the same functionality; works seamlessly in cloud-based collaborative environments
✓LibreOffice
=ROWS(array) - Compatible with LibreOffice Calc using standard syntax