# ROWS formula generator

> Describe what you need and get a ROWS formula for Excel and Google Sheets, run on real data before you copy it. Plus 8 tested ROWS examples.

Source: https://spreadsheetpractice.com/tools/formula-generator/rows · Updated October 29, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

ROWS counts how many rows a range or array has, whether or not the cells contain anything.

Describe the task at [ROWS formula generator](https://spreadsheetpractice.com/tools/formula-generator/rows) and get a ROWS formula for Excel and Google Sheets, tested on real data.

## Tested ROWS examples

### Count unique combinations of two columns

`=ROWS(UNIQUE(A2:B13))`

Excel. Result on the sample sheet: 10. [See it and try it](https://spreadsheetpractice.com/formulas/count-unique-combinations-of-two-columns)

### Calculate CAGR

`=(B6/B2)^(1/(A6-A2))-1`

Excel. Result on the sample sheet: 11.62%. [See it and try it](https://spreadsheetpractice.com/formulas/calculate-cagr)

### Calculate the percentage of Yes responses

`=COUNTIF(B2:B13,"Yes")/COUNTA(B2:B13)`

Excel. Result on the sample sheet: 70.0%. [See it and try it](https://spreadsheetpractice.com/formulas/percentage-of-yes-responses)

### Calculate the percentage of projects within budget

`=SUMPRODUCT(--(C2:C11<=B2:B11))/ROWS(B2:B11)`

Excel. Result on the sample sheet: 70%. [See it and try it](https://spreadsheetpractice.com/formulas/percentage-of-projects-within-budget)

### Average numbers

`=AVERAGE(B2:B7)`

Excel. Result on the sample sheet: 69.80. [See it and try it](https://spreadsheetpractice.com/formulas/average-numbers)

### Reverse the order of a list

`=SORTBY(A2:A9,SEQUENCE(ROWS(A2:A9)),-1)`

Excel. Result on the sample sheet: 8 rows (C2:C9). [See it and try it](https://spreadsheetpractice.com/formulas/reverse-the-order-of-a-list)

### Get every nth row

`=FILTER(A2:B13,MOD(SEQUENCE(ROWS(A2:A13)),E1)=0)`

Excel. Result on the sample sheet: 4 rows (D3:E6). [See it and try it](https://spreadsheetpractice.com/formulas/get-every-nth-row)

### Return the next item in a list after a given value

`=INDEX(A2:A7,MOD(MATCH(D1,A2:A7,0),ROWS(A2:A7))+1)`

Excel. Result on the sample sheet: Tom. [See it and try it](https://spreadsheetpractice.com/formulas/next-item-in-list-wraparound)

## Questions

### What does the ROWS formula generator do?

You describe the task in plain English, and it writes the formula, using ROWS where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.

### What does ROWS do?

ROWS counts how many rows a range or array has, whether or not the cells contain anything.

### Can I learn to write ROWS formulas myself?

Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the ROWS function page has a practice exercise.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
