Count a value across multiple columns
=COUNTIF(B2:F6,H1)Excel · result on the sample sheet: 8
Describe what you need and get a working COUNTIF formula for Excel and Google Sheets, tested on real data before you copy it. COUNTIF counts the cells in a range that meet one condition: tickets marked "Open", scores of 70 or more, product names containing "lamp".
Each formula below was calculated on its own sample sheet. Open one to see the sheet, why it works, and to try it yourself.
=COUNTIF(B2:F6,H1)Excel · result on the sample sheet: 8
=COUNTIF(B2:B12,E1)Excel · result on the sample sheet: 4
=COUNTIF(B2:F2,"P")Excel · result on the sample sheet: 6 rows (G2:G7)
=COUNTIF(C2:C9,TRUE)Google Sheets · result on the sample sheet: 5
=COUNTIF(B2:B8,">="&E1)Excel · result on the sample sheet: 5
=IF(COUNTIF(A2:A9,D1)>0,"Yes","No")Excel · result on the sample sheet: Yes
=FILTER(A2:E11,COUNTIF(G2:G4,C2:C11))Excel · result on the sample sheet: 4 rows (I2:M5)
=SUMPRODUCT(B2:B10/COUNTIF(A2:A10,A2:A10))Excel · result on the sample sheet: $8,830
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.
COUNTIF counts the cells in a range that meet one condition: tickets marked "Open", scores of 70 or more, product names containing "lamp".
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.