Counting cells in Excel is a common task, whether you’re tallying up entries, checking for blanks, or counting cells that meet a specific condition. The fastest way to count all non-empty cells in a range is to use the COUNTA function. For counting only numbers, use COUNT. For conditional counts, use COUNTIF or COUNTIFS. This guide walks you through each method, including how to use the status bar for a quick count, and covers common mistakes and troubleshooting.
What You’ll Need
- Microsoft Excel (Microsoft 365, Excel 2021, 2019, or earlier versions; steps are similar for Excel for the web and Mac).
- A worksheet with data in a range of cells.
- Basic familiarity with selecting cells and typing formulas.
Step-by-Step
Method 1: Quick Count Using the Status Bar
- Open your Excel worksheet.
- Click and drag to select the range of cells you want to count. For example, select A1:A20.
- Look at the bottom-right corner of the Excel window, in the status bar. You’ll see “Count:” followed by a number. This number is the count of non-empty cells in your selection.
- Right-click the status bar to customize what appears. Check “Count,” “Numerical Count,” or “Sum” to add more statistics.
- This method is instant and requires no formulas. Note: the status bar count includes text, numbers, and errors, but not truly blank cells.
Method 2: Count All Non-Empty Cells with COUNTA
- Click on an empty cell where you want the result to appear, say B1.
- Type the formula:
=COUNTA(A1:A20)(adjust the range to match your data). - Press Enter. The cell displays the number of cells in A1:A20 that are not empty (contains any text, number, error, or formula result).
- If you want to count cells that contain only numbers, use
=COUNT(A1:A20)instead. This ignores text and blank cells.
Method 3: Count Cells That Meet a Condition with COUNTIF
- Suppose you have a list of sales in column A and you want to count how many are greater than 100. Click on an empty cell, say B2.
- Type:
=COUNTIF(A1:A20,">100"). The criteria must be in quotes, and the range comes first. - Press Enter. The result shows the count of cells with values greater than 100.
- For text criteria, for example count cells that contain “Yes”, use
=COUNTIF(A1:A20,"Yes"). For partial matches, use wildcards:=COUNTIF(A1:A20,"*Yes*")counts cells that contain “Yes” anywhere. - For multiple conditions, use
COUNTIFS. Example:=COUNTIFS(A1:A20,">100",B1:B20,"West")counts rows where column A > 100 and column B equals “West”.
Method 4: Count Blank Cells with COUNTBLANK
- To count empty cells in a range, use
=COUNTBLANK(A1:A20). - This counts cells that are truly empty, including cells with formulas that return an empty string (“”) but not cells with spaces.
Method 5: Count Cells with Specific Length or Other Complex Criteria
- For more complex counting, combine functions. For example, to count cells with exactly 5 characters, use
=SUMPRODUCT(--(LEN(A1:A20)=5)). - For counting cells that contain a number and are also formatted as currency, you’d need a helper column; but for most needs, COUNTIFS is sufficient.
Common Mistakes
- Using COUNT instead of COUNTA: COUNT only counts numeric cells. If your data has text, you’ll get a lower number than expected.
- Wrong range references: Make sure the range in the formula matches the actual data. If you include extra blank rows, COUNTA will still count correctly, but COUNTIF might not.
- Criteria syntax errors: For COUNTIF, text and logical operators must be in double quotes. For example,
=COUNTIF(A1:A20,>100)is invalid; you need=COUNTIF(A1:A20,">100"). - Counting cells with spaces: A cell with a space appears non-empty to COUNTA. Use
=COUNTIF(A1:A20,"?*")to count cells with at least one character (excluding spaces). - Not updating range when adding data: If you add rows later, the formula range may not expand automatically. Consider using a Table (Insert > Table) so ranges auto-expand.
Tips
- Use the status bar for a quick check before writing a formula.
- For counting unique values, use
=SUMPRODUCT(1/COUNTIF(A1:A20,A1:A20))(works in all versions) or the newer=COUNTA(UNIQUE(A1:A20))in Excel 365. - To count cells based on color, you cannot use standard functions; you’ll need VBA or the “Filter by Color” and then use SUBTOTAL.
- When using COUNTIFS, all ranges must be the same size; otherwise, you’ll get a #VALUE! error.
- For a running count in a column, use the formula
=COUNTA($A$1:A2)and drag down.
Troubleshooting
- Formula returns 0 when there are clearly values: Check if the values are numbers stored as text. Use the “Convert to Number” warning or multiply by 1. For COUNT, text numbers are ignored.
- #VALUE! error in COUNTIFS: This usually means the ranges are not the same size. Ensure all ranges have the same number of rows and columns.
- #NAME? error: This means Excel doesn’t recognize a function. Check spelling, especially if you’re using a function like UNIQUE that requires Excel 365.
- Count seems too high: You might be counting cells with formulas that return an empty string. Use
=COUNTIF(A1:A20,"?*")to exclude those. - Status bar doesn’t show Count: Right-click the status bar and ensure “Count” is checked.
Frequently Asked Questions
What is the difference between COUNT and COUNTA?
COUNT counts only cells that contain numbers (including dates and times). COUNTA counts all non-empty cells, including text, numbers, errors, and logical values. Use COUNT when you need a numeric total; use COUNTA when you need a total of everything entered.
How do I count cells that contain specific text?
Use COUNTIF with the text in quotes. For example, =COUNTIF(A1:A20,"Apple") counts cells exactly equal to “Apple”. For partial matches, use wildcards: =COUNTIF(A1:A20,"*Apple*") counts cells that contain “Apple” anywhere.
Can I count cells based on multiple conditions?
Yes, use COUNTIFS. It accepts multiple range/criteria pairs. For example, =COUNTIFS(A1:A20,">10",B1:B20,"Yes") counts rows where column A is greater than 10 and column B is “Yes”. All ranges must be the same size.
How do I count non-empty cells in a filtered list?
Use the SUBTOTAL function with function number 3 (COUNTA) or 2 (COUNT). For example, =SUBTOTAL(3,A1:A20) counts non-empty cells in the visible (filtered) range only. This is useful when you apply filters to your data.
Why does my COUNTIF formula return 0 for numbers?
If your numbers are stored as text (they align left by default), COUNTIF may not match them. Convert them to numbers by selecting the range, clicking the warning icon, and choosing “Convert to Number”. Then re-enter the formula.
How do I count cells that are not blank but also not errors?
Use a formula like =COUNTA(A1:A20)-COUNTIF(A1:A20,"#N/A") but that only works for a specific error. A more robust way is to use =SUMPRODUCT(--(A1:A20<>"")) which counts non-empty cells, but it still includes errors. To exclude errors, use =SUMPRODUCT(--(ISNUMBER(A1:A20))) for numbers only, or use an array formula with IFERROR. For simplicity, use =COUNT(A1:A20) if you only want numbers and not errors.
Related
- Random Number 0-9: How to Generate Them
- Camera with Speed Detection: How It Works & What to Know
- XLS Conditional Formatting: How to Use It
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Find Blank Cells in Excel and Fill Them With ZeroTo find blank cells in an Excel range and fill them with zero, select the range, choose Home…
- Add Data Bars to an Excel Table: Steps and TipsTo add data bars to an Excel table in Microsoft 365 for Windows, select the numeric cells in…
- Add Page Numbers to a PowerPoint Slide MasterTo add slide numbers across a PowerPoint presentation, choose Insert > Header & Footer, select Slide number on…
- Budget Spreadsheet South Africa: Build a Rand-Based PlanA useful South African budget spreadsheet is a monthly Excel workbook that records income and spending in rand…
- How to Archive Emails in Outlook on the Web EasilyTo archive an email in Outlook on the web, select it in your message list and choose Archive…
- Audit Plan Template Excel: Build a Usable WorkbookAn audit plan template in Excel is a workbook for recording an audit’s objectives, scope, risks, procedures, owners,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.