ISNUMBER function
The ISNUMBER function in Excel is used to check if a value is a number. It returns TRUE if the value is a number (including integers, decimals, and dates, which are stored as serial numbers in Excel) and FALSE if the value is not a number.
Syntax:
ISNUMBER(value)
Arguments:
- value: The value or expression you want to check. This can be a cell reference, a formula, or a direct value.
Example:
Example 1: Cell contains a number
- Data in A1:
10 - Formula:
=ISNUMBER(A1) - Result:
TRUE(since A1 contains the number 10).
Example 2: Cell contains a text value
- Data in B1:
"Hello" - Formula:
=ISNUMBER(B1) - Result:
FALSE(since B1 contains text, not a number).
Example 3: Cell contains a formula that returns a number
- Data in C1:
=SUM(1, 2, 3) - Formula:
=ISNUMBER(C1) - Result:
TRUE(since the result of the formula is6, which is a number).
Example 4: Cell contains a date (which is stored as a number)
- Data in D1:
01/01/2025(date format) - Formula:
=ISNUMBER(D1) - Result:
TRUE(since Excel stores dates as serial numbers, and this is recognized as a number).
Example 5: Cell contains an error
- Data in E1:
#DIV/0!(error from a division by zero) - Formula:
=ISNUMBER(E1) - Result:
FALSE(since errors are not numbers).
Key Points:
- Numbers: Includes positive and negative integers, decimals, and dates (since Excel treats dates as serial numbers).
- Text & Non-Numeric Data: ISNUMBER will return
FALSEfor text, logical values (TRUEorFALSE), and error values (#DIV/0!,#VALUE!, etc.). - Formulas: If the formula results in a number, ISNUMBER returns
TRUE. If the result is non-numeric (like a string or error), it returnsFALSE.
Use Cases:
- Data Validation: Use ISNUMBER to ensure that a value is a number before performing calculations:
=IF(ISNUMBER(A1), A1*2, "Not a number") - Error Handling: Prevent errors from invalid data input by checking for numbers:
=IF(ISNUMBER(A1), "Valid number", "Invalid input") - Counting Numbers: Combine ISNUMBER with COUNTIF to count cells with numbers:
=COUNTIF(A1:A10, ">=0") ' Count numbers greater than or equal to zero.