# COUNTIF formula generator

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

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

COUNTIF counts the cells in a range that meet one condition: tickets marked "Open", scores of 70 or more, product names containing "lamp".

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

## Tested COUNTIF examples

### Count a value across multiple columns

`=COUNTIF(B2:F6,H1)`

Excel. Result on the sample sheet: 8. [See it and try it](https://spreadsheetpractice.com/formulas/count-a-value-across-multiple-columns)

### Count cells equal to a specific value

`=COUNTIF(B2:B12,E1)`

Excel. Result on the sample sheet: 4. [See it and try it](https://spreadsheetpractice.com/formulas/count-cells-equal-to-a-value)

### Count attendance

`=COUNTIF(B2:F2,"P")`

Excel. Result on the sample sheet: 6 rows (G2:G7). [See it and try it](https://spreadsheetpractice.com/formulas/count-attendance)

### Count checkboxes

`=COUNTIF(C2:C9,TRUE)`

Google Sheets. Result on the sample sheet: 5. [See it and try it](https://spreadsheetpractice.com/formulas/count-checkboxes)

### Why does COUNTIF return 0 when the criteria refers to a cell

`=COUNTIF(B2:B8,">="&E1)`

Excel. Result on the sample sheet: 5. [See it and try it](https://spreadsheetpractice.com/formulas/countif-criteria-with-cell-reference)

### Check if a value exists in a range

`=IF(COUNTIF(A2:A9,D1)>0,"Yes","No")`

Excel. Result on the sample sheet: Yes. [See it and try it](https://spreadsheetpractice.com/formulas/check-if-value-exists-in-a-range)

### Filter by a list of values

`=FILTER(A2:E11,COUNTIF(G2:G4,C2:C11))`

Excel. Result on the sample sheet: 4 rows (I2:M5). [See it and try it](https://spreadsheetpractice.com/formulas/filter-by-a-list-of-values)

### Sum values without counting duplicates

`=SUMPRODUCT(B2:B10/COUNTIF(A2:A10,A2:A10))`

Excel. Result on the sample sheet: $8,830. [See it and try it](https://spreadsheetpractice.com/formulas/sum-without-counting-duplicates)

## Questions

### What does the COUNTIF formula generator do?

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

COUNTIF counts the cells in a range that meet one condition: tickets marked "Open", scores of 70 or more, product names containing "lamp".

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