Spreadsheet Practice

How to check if a cell contains a number in Excel

Excel formula

=COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0

Look for each digit 0 to 9 and count the hits: =COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0. In Google Sheets use =REGEXMATCH(A2,"\d").

Result on the example
one result per row in B2, filled down to B7
Works in
Every current version
Google Sheets
Different formula, see below

See it work

The formula is already in B2, filled down to B7. Change any input and the result updates, or edit the formula to experiment.

How it works

FIND with the list {0,1,…,9} searches for each digit and returns ten results: a position where the digit appears, an error where it doesn't. COUNT counts only the positions, so anything above 0 means the text contains a digit.

In Google Sheets, \d is the pattern for any digit.

=COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0

ResultFALSE

  1. {0,1,2,3,4,5,6,7,8,9}{1 row × 10 cols} 0, 1, 2, 3, …

    An array of values.

  2. A2"mlopez"

    The value in A2.

  3. FIND({0,1,2,3,4,5,6,7,8,9},A2){1 row × 10 cols} #VALUE!, #VALUE!, #VALUE!, #VALUE!, …

    FIND: Position of text, case-sensitive.

    • find_text{0,1,2,3,4,5,6,7,8,9}{1 row × 10 cols} 0, 1, 2, 3, …
    • within_textA2"mlopez"
  4. COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))0

    COUNT: Counts cells that contain numbers.

    • value1FIND({0,1,2,3,4,5,6,7,8,9},A2){1 row × 10 cols} #VALUE!, #VALUE!, #VALUE!, #VALUE!, …
  5. COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0FALSE

    The > operator tests greater than.

In Google Sheets

Google Sheets needs a different formula: =REGEXMATCH(A2,"\d"). On the same data it gives the same result. Here it is running in Google Sheets mode.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=SUMPRODUCT(--ISNUMBER(FIND({0,1,2,3,4,5,6,7,8,9},A2)))>0FALSE, TRUE, FALSE…The same test with SUMPRODUCT, a common form in older workbooks.

Common mistakes

  • ISNUMBER(A2) answers a different question: whether the whole cell is a number, not whether the text contains a digit.
  • In Google Sheets, the FIND version needs ARRAYFORMULA to search for all ten digits; REGEXMATCH doesn't.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Check if a cell contains a number

In B2, return TRUE when the username contains at least one digit and FALSE otherwise. Fill down to B7.

Questions

How do I check that the cell contains only digits?

In Excel 365 use =REGEXTEST(A2,"^\d+$"), in Google Sheets =REGEXMATCH(A2,"^\d+$").

How do I extract the numbers?

Use =--CONCAT(IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,"")).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.