# COUNT formula generator

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

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

COUNT tells you how many cells contain numbers.

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

## Tested COUNT examples

### Count cells that contain numbers

`=COUNT(B2:B11)`

Excel. Result on the sample sheet: 6. [See it and try it](https://spreadsheetpractice.com/formulas/count-cells-with-numbers)

### Fix the #NAME? error

`=AVERAGE(B2:B9)`

Excel. Result on the sample sheet: 75.5. [See it and try it](https://spreadsheetpractice.com/formulas/name-error-misspelled-function)

### Calculate days between dates only when both dates are filled

`=IF(OR(B2="",C2=""),"",C2-B2)`

Excel. Result on the sample sheet: 6 rows (D2:D7). [See it and try it](https://spreadsheetpractice.com/formulas/days-between-dates-only-when-both-are-filled)

### Calculate percent change from the first to the last value

`=XLOOKUP(TRUE,B2:B13<>"",B2:B13,,0,-1)/B2-1`

Excel. Result on the sample sheet: 23.0%. [See it and try it](https://spreadsheetpractice.com/formulas/percent-change-first-to-last-value)

### Calculate percent rank

`=COUNTIF($B$2:$B$11,"<"&B2)/(COUNT($B$2:$B$11)-1)`

Excel. Result on the sample sheet: 10 rows (C2:C11). [See it and try it](https://spreadsheetpractice.com/formulas/percent-rank)

### Calculate the average time

`=AVERAGE(B2:B8)`

Excel. Result on the sample sheet: 8:56 AM. [See it and try it](https://spreadsheetpractice.com/formulas/average-time)

### Average numbers

`=AVERAGE(B2:B7)`

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

### Calculate the average number of days between two dates

`=AVERAGE(FILTER(C2:C8-B2:B8,C2:C8<>""))`

Excel. Result on the sample sheet: 4.3. [See it and try it](https://spreadsheetpractice.com/formulas/average-days-between-two-dates)

## Questions

### What does the COUNT formula generator do?

You describe the task in plain English, and it writes the formula, using COUNT 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 COUNT do?

COUNT tells you how many cells contain numbers.

### Can I learn to write COUNT 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 COUNT 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.
