Features of !SEMTools
↑ Navigate Excel tasks and !SEMTools add-in features ↑

COUNTA

Function categoryStatistical
VolatilityNon-volatile
Similar functionsCOUNT
SyntaxCOUNTA(value1, [value2], ...)
COUNTA function - usage examples

What does the COUNTA function do?

The function counts the number of non-empty cells in one or more selected ranges.

COUNTA function syntax

The function syntax includes one required argument and additional optional arguments, up to 255 total. The argument can be a range of any size, a single cell or a value.

=COUNTA(value1,[value2],...)
COUNTA, COUNT and COUNTBLANK
E2=COUNTA(A2:A8)
ABCDE
1DataWhat’s in the cellFunctionResult
2LondontextCOUNTA6=COUNTA(A2:A8)
3125numberCOUNT3=COUNT(A2:A8)
4emptyCOUNTBLANK2=COUNTBLANK(A2:A8)
510/22/2026dateROWS7=ROWS(A2:A8)
6#N/Aerror
7=IF(1>2,1,"")formula returning ""
80zero

COUNTA counts everything except truly empty cells: text, numbers, dates (they are numbers), errors, zero and even a formula that returns an empty string (A7). COUNT counts only numbers and dates. COUNTBLANK counts A4 and A7 — so COUNTA + COUNTBLANK can exceed the number of cells.

Support for multiple arguments allows you to simultaneously check whether data is filled in multiple unrelated ranges, including on different sheets.

Several ranges at once
E2=COUNTA(A2:A5,C2:C5)
ABCDE
1PlanActualFilled
2January1206=COUNTA(A2:A5,C2:C5)
3February95
4March
580

Arguments are separated by commas: A2:A5 has three values, C2:C5 also three, 6 in total. Ranges can be on different sheets: =COUNTA(Sheet1!A:A,Sheet2!A:A).

COUNTA: result and input format

The function accepts any input values, including calculation results, manually entered text, numeric and other values, data ranges of any size, including single cells. See examples in the header.

Counts cells containing text, even if the text string is empty ("").

Counts cells with error values (e.g., #DIV/0!, #N/A).

Empty strings and errors count too
E3=COUNTIF(A2:A6,"?*")+COUNT(A2:A6)+SUMPRODUCT(--ISERROR(A2:A6))
ABCDE
1ValueTypeHow to countResult
2LondontextCOUNTA4=COUNTA(A2:A6)
3=""empty string ""without ""3=COUNTIF(A2:A6,"?*")+COUNT(A2:A6)+SUMPRODUCT(--ISERROR(A2:A6))
4#DIV/0!=1/0errortext and numbers only2=COUNTIF(A2:A6,"?*")+COUNT(A2:A6)
542number
6empty

If formulas in a column return "", COUNTA counts them as filled. The "?*" criterion in COUNTIF means text of at least one character, so empty strings are skipped; COUNT adds the numbers and ISERROR the errors.

Return value format is a positive integer or 0 (zero).

Examples of COUNTA usage

The function is useful as an auxiliary tool in situations where you need to determine whether a range contains any values or not.

Example 1. Removing empty rows

In short - empty rows often interfere with data analysis (read more about why it's important and how to remove empty rows in Excel using various methods). But deleting them isn't easy, especially if there are many.

A pragmatic solution is to use the COUNTA function in the first column to check rows for data. If the value is greater than zero, the row is not empty and shouldn't be deleted. And vice versa :)

Find empty rows
F3=COUNTA(A3:C3)=0
ABCDEF
1ClientPhoneAmountFilledEmpty?
2Acme Inc(206) 555-0142150003=COUNTA(A2:C2)FALSE=COUNTA(A2:C2)=0
30=COUNTA(A3:C3)TRUE=COUNTA(A3:C3)=0
4Globex80002=COUNTA(A4:C4)FALSE=COUNTA(A4:C4)=0
50=COUNTA(A5:C5)TRUE=COUNTA(A5:C5)=0

COUNTA over the whole row = 0 means the row is empty. Filter column F by TRUE and delete those rows.

Example 2. Employee salary calculation

Let's say the office has a device at the entrance that identifies employees by fingerprints. The COUNTA function in Excel can be used to count the number of days when an employee registered at the entrance. Here's how it might look:

example table for counting cells with COUNTA function
  • Each time an employee comes to work and passes fingerprint identification, the system registers their presence that day.
  • Registration data is exported to Excel, where each row corresponds to an employee, and each column corresponds to a specific working day of the month. The employee's arrival time on a particular day is marked in the corresponding cell.
  • The COUNTA function is used to count the number of days each employee was registered at work. For example, the formula =COUNTA(B2:AF2) will count the number of filled cells in row 2 from B2 to AF2, which corresponds to the number of days the employee was at the workplace.
  • Using the counted number of working days, the accountant can calculate the employee's salary by multiplying this number by the daily pay rate.
Timesheet: days present and pay
G2=COUNTA(B2:F2)
ABCDEFGHI
1Employee10/0110/0210/0310/0410/05DaysRatePay
2Smith8:559:028:479:104=COUNTA(B2:F2)2501000=G2*H2
3Brown9:008:582=COUNTA(B3:F3)300600=G3*H3
4Jones8:408:458:508:418:395=COUNTA(B4:F4)2201100=G4*H4

A check-in time in a cell means the employee was at work. COUNTA across the row counts the days, and multiplying by the daily rate gives the pay.

This method allows the accountant to automate the process of counting working days and facilitates salary calculation based on employees' actual presence at work.

See also:

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.