Our 10 featured functions

COUNT

Matches all 1,237 recorded answers

Recorded: 1,212 in the answer bank and 25 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicCOUNT
BulgarianCOUNT
CzechCOUNT
DanishTÆL
GermanANZAHL
GreekCOUNT
English (Australia)COUNT
English (United Kingdom)COUNT
English (United States)COUNT
SpanishCONTAR
EstonianCOUNT
FinnishLASKE
FrenchNB
HebrewCOUNT
CroatianCOUNT
HungarianDARAB
IndonesianCOUNT
ItalianCONTA.NUMERI
JapaneseCOUNT
KoreanCOUNT
LithuanianCOUNT
LatvianCOUNT
NorwegianANTALL
DutchAANTAL
PolishILE.LICZB
Portuguese (Brazil)CONT.NÚM
Portuguese (Portugal)COUNT
RomanianCOUNT
RussianСЧЁТ
SlovakCOUNT
SlovenianCOUNT
Serbian (Latin)COUNT
SwedishANTAL
ThaiCOUNT
TurkishBAĞ_DEĞ_SAY
UkrainianCOUNT
VietnameseCOUNT
Chinese (Simplified)COUNT
Chinese (Hong Kong)COUNT
Chinese (Traditional)COUNT

Names from Microsoft's support site.

What it does

COUNT(value1, [value2], ...)

COUNT(value1, [value2], ...) counts numeric entries. It measures how many numbers are present, rather than adding their values. Dates stored as Excel serial numbers count as numbers.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

=COUNT(8,"12",TRUE) returns 3 under the documented direct-argument rules. With A1:A4 containing 8, the text 12, TRUE, and an empty cell, =COUNT(A1:A4) returns 1.

Quirks

References and arrays count numbers only; their text, logical values, blanks and errors do not count. Direct numeric text and logical constants can count. Consequently COUNT is not a nonempty-cell count, and a formula returning an empty string is text.

How to implement

Visit every argument while preserving its direct/reference origin. For a referenced or array element increment only for numeric values. For a direct scalar also admit the documented logical and numeric-text cases. Do not increment for an error or unconvertible text. Use an integer accumulator and return the count as a worksheet number. The direct example admits three values even though only one is a numeric literal.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

COUNT · 1 lines · calc-func/src/catalogue/aggregate.rs on GitHub
aggregate(COUNT, "COUNT", VALUES, count)
count · 24 lines · calc-func/src/catalogue/aggregate.rs on GitHub
/// COUNT: how many numbers there are. A held number counts; a direct argument counts when it is
/// a number, a logical, text that reads as a number, or omitted (read as 0). Nothing else counts,
/// and an error is not the result. Counting needs no rounding.
fn count(
    arguments: &[CalcValue],
    services: &mut EvalServices<'_>,
) -> Result<CalcValue, FunctionFault> {
    let site = Site::new(COUNT, services);
    let mut counted = 0u64;
    let read_through = read_through_held_arrays(arguments);
    let arguments: &[CalcValue] = read_through.as_deref().unwrap_or(arguments);
    let held = match read_held_references(&site, services, arguments, HeldReference::NoNumber) {
        Ok(held) => held,
        Err(exit) => return Site::finish(Err(exit)),
    };
    let arguments: &[CalcValue] = held.as_deref().unwrap_or(arguments);
    let read = each_value(&site, arguments, services, &mut |index, origin, value| {
        if counts_as_number(&site, index, origin, value)? {
            counted += 1;
        }
        Ok(())
    });
    Site::finish(read.and_then(|()| site.number(counted as f64)))
}
counts_as_number · 33 lines · calc-func/src/catalogue/aggregate.rs on GitHub
fn counts_as_number(
    site: &Site<'_>,
    index: usize,
    origin: Origin,
    value: &CalcValue,
) -> Step<bool> {
    match (origin, value.core_ref()) {
        (_, CoreRef::Number(n)) => finite(site, index, n).map(|()| true),
        (Origin::Direct, CoreRef::Logical(_) | CoreRef::Empty | CoreRef::Missing) => Ok(true),
        // Whether the text reads as a number decides; its value is not used, so nothing rounds.
        (Origin::Direct, CoreRef::Text(_)) => match coerce::number(value) {
            Ok(Numeric::Decimal(decimal)) => match decimal.nearest() {
                Ok(_) => Ok(true),
                // Decimal text beyond the range Excel reads is no number, not an error.
                Err(Stop::Error(_)) => Ok(false),
                Err(stop) => Err(site.stop(stop, Some(index))),
            },
            Ok(Numeric::Number(_)) => Ok(true),
            Err(Stop::Error(_)) => Ok(false),
            // Text coercion alone does not read (a date without a year, dc-bd5: COUNT("1/2") is
            // 1): read as VALUE reads it under the call's environment.
            Err(Stop::NotModelled) => match site.read_text(index, value) {
                Ok(Some(_)) => Ok(true),
                Ok(None) => Err(site.not_modelled(Some(index))),
                Err(Exit::Error(_)) => Ok(false),
                Err(exit) => Err(exit),
            },
        },
        (_, CoreRef::Array(_) | CoreRef::Reference(_)) => Err(site.not_modelled(Some(index))),
        (_, CoreRef::Text(_) | CoreRef::Logical(_) | CoreRef::Error(_))
        | (Origin::Held | Origin::Element, CoreRef::Empty | CoreRef::Missing) => Ok(false),
    }
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
20430Windows, 64-bit, CPU not recorded1,212

The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.

Recorded environments and comparison details.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

1,212 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

COUNTA counts nonempty values; COUNTBLANK counts blanks; COUNTIF and COUNTIFS count matches.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents