To count cells in Excel, use the COUNT family of functions: =COUNT for numeric cells, =COUNTA for non-empty cells, and =COUNTIF or =COUNTIFS for cells that meet one or more conditions. Type the formula into an empty cell, press Enter, and Excel returns the count. This guide walks through each formula, how to apply it, and how to fix common errors.
What You'll Need
- Microsoft Excel (any recent version: Microsoft 365, Excel 2019, 2021, or 2024) on Windows, Mac, or the web.
- A worksheet with data you want to count.
- Basic familiarity with selecting cells and typing formulas.
Step-by-Step
- Open your workbook and click the cell where you want the result to appear. Choose an empty cell away from your data to avoid overwriting.
- Start the formula with an equals sign (=). This tells Excel you are entering a formula, not text.
- Choose the right count function:
- COUNT – counts cells containing numbers only. Example:
=COUNT(A1:A10)counts numeric entries in A1 through A10. - COUNTA – counts all non-empty cells, including text, numbers, and errors. Example:
=COUNTA(A1:A10). - COUNTBLANK – counts empty cells. Example:
=COUNTBLANK(A1:A10). - COUNTIF – counts cells that meet one condition. Example:
=COUNTIF(A1:A10, ">5")counts numbers greater than 5. - COUNTIFS – counts cells that meet multiple conditions across ranges. Example:
=COUNTIFS(A1:A10, ">5", B1:B10, "Yes").
- COUNT – counts cells containing numbers only. Example:
- Type the function name and an opening parenthesis, then select the range. You can drag over cells or type the range address (e.g., A1:A10).
- For COUNTIF/COUNTIFS, add the criteria after a comma. Use quotes for text or logical operators (e.g., ">10", "Apple"). For cell references as criteria, concatenate with & (e.g., ">"&C1).
- Close the parenthesis and press Enter. The result appears in the cell.
- Copy the formula to other cells if needed. Use relative references (like A1:A10) to adjust automatically, or absolute references ($A$1:$A$10) to keep the range fixed.
Common Mistakes
- Using COUNT on text: COUNT ignores text and logical values. Use COUNTA to count all non-empty cells.
- Forgetting quotes around text criteria: In COUNTIF, text criteria must be in double quotes (e.g., "Apple"). Numbers and cell references do not need quotes.
- Mismatched ranges in COUNTIFS: All ranges must be the same size, or Excel returns a #VALUE! error.
- Including the header row: If your range includes headers, COUNTA will count them. Start ranges below the header or use COUNTIF to exclude specific text.
- Not locking ranges when copying: Without absolute references, copied formulas may shift and count the wrong cells.
Tips
- Use COUNTIF with wildcards: * for any number of characters, ? for a single character. Example:
=COUNTIF(A1:A10, "A*")counts cells starting with A. - Combine COUNTIF with SUMPRODUCT for more complex criteria, or use COUNTIFS for multiple conditions.
- Press F4 while editing a reference to toggle absolute/relative references quickly.
- Use Name Box to select large ranges quickly: type A1:A1000 in the Name Box and press Enter.
- To count unique values, use
=SUMPRODUCT(1/COUNTIF(A1:A10, A1:A10))(adjust range).
Troubleshooting
- Formula returns 0 unexpectedly: Check if the range contains numbers stored as text. Use VALUE or Text to Columns to convert. Also verify criteria syntax.
- #VALUE! error: Likely mismatched range sizes in COUNTIFS or invalid criteria. Ensure all ranges are same dimensions.
- #NAME? error: Function name misspelled. Check spelling (e.g., COUNTIF not COUNTIFS).
- Counting blanks incorrectly: COUNTBLANK counts cells with empty strings ("") as blank. Use COUNTIF(range, "") to count truly empty cells.
- Formula not updating: Check if calculation is set to Manual. Go to Formulas > Calculation Options > Automatic.
Frequently Asked Questions
What is the difference between COUNT and COUNTA?
COUNT counts only cells with numbers. COUNTA counts all non-empty cells, including text, numbers, and errors.
How do I count cells with specific text?
Use COUNTIF with the text in quotes: =COUNTIF(A1:A10, "Apple"). For partial matches, use wildcards: =COUNTIF(A1:A10, "*Apple*").
Can I count cells across multiple sheets?
Yes, use a 3D reference: =COUNT(Sheet1:Sheet3!A1:A10) counts the same range across sheets. For COUNTIF, you may need to sum individual COUNTIFs.
Why does COUNTIF return wrong results with numbers?
If numbers are stored as text, COUNTIF may not match. Ensure cells are formatted as numbers, or use SUMPRODUCT with VALUE.
How do I count cells that are not blank?
Use COUNTA or COUNTIF with "<>" criteria: =COUNTIF(A1:A10, "<>").
Can I use COUNTIF with dates?
Yes, use date criteria in quotes or cell references: =COUNTIF(A1:A10, ">"&DATE(2023,1,1)).