To check if a cell contains a number and perform a specific action based on that result, use the formula =IF(ISNUMBER(cell), value_if_true, value_if_false). This combination allows Excel to distinguish between numeric data and text, errors, or empty cells, ensuring that calculations only run on valid numbers to prevent errors like #VALUE!. This is essential for cleaning data, validating user input, and creating dynamic reports where some cells might contain notes (text) while others contain figures.
What You'll Need
- Microsoft Excel (any version, including Excel for the Web, Excel for Mac, or Office 365).
- A dataset containing a mix of numbers, text, or blank cells that requires validation.
- A basic understanding of how to select cells and enter formulas into the formula bar.
Step-by-Step
- Identify the Target Cell: Locate the cell you want to test. For example, if you have a list of prices in column A and some cells contain the word "Pending" instead of a number, your target cell for the first row would be A2.
- Start the IF Function: Click on the cell where you want the result to appear (e.g., B2). Type
=IF(. The IF function is the logic engine that tells Excel: "If this condition is met, do X; otherwise, do Y." - Nest the ISNUMBER Function: Immediately after the opening parenthesis of the IF function, type
ISNUMBER(A2). The ISNUMBER function is a logical test that returns TRUE if the value is a number and FALSE if it is anything else (text, a date stored as text, or an error). - Define the "True" Result: Type a comma after the ISNUMBER closing parenthesis. Now, enter what should happen if the cell is a number.
- If you want to return text, put it in quotes:
"Valid Number". - If you want to perform a calculation, enter the math:
A2*0.15(to calculate a 15% tax, for example).
- If you want to return text, put it in quotes:
- Define the "False" Result: Type another comma. Now, enter what should happen if the cell is not a number.
- To leave the cell blank, use two double quotes:
"". - To flag the cell for review, use
"Check Data".
- To leave the cell blank, use two double quotes:
- Close the Formula: Type the final closing parenthesis
)and press Enter. Your complete formula should look something like this:=IF(ISNUMBER(A2), A2*0.15, "Check Data"). - Apply to the Entire Column: Hover your mouse over the bottom-right corner of the cell (the Fill Handle) until the cursor turns into a small black cross. Click and drag downward to apply the logic to all rows in your dataset.
Common Mistakes
One of the most frequent errors is forgetting that dates are numbers in Excel. Because Excel stores dates as sequential serial numbers, ISNUMBER will return TRUE for any cell formatted as a date. If you need to exclude dates but keep general numbers, you will need a more complex formula involving the CELL function to check the formatting.
Another common mistake is confusing numbers stored as text with actual numbers. If a number was imported from a CSV or a database and has a small green triangle in the corner of the cell, Excel treats it as text. ISNUMBER will return FALSE for these cells, even though they look like numbers to the human eye. You must convert these to numbers using the "Convert to Number" warning or the VALUE function before the formula will work as expected.
Users also frequently forget the double quotes around text strings. In Excel formulas, any plain text must be enclosed in quotes. Writing =IF(ISNUMBER(A2), Yes, No) will result in a #NAME? error because Excel thinks "Yes" and "No" are named ranges rather than words.
Tips
To make your spreadsheets more professional, combine IF and ISNUMBER with Conditional Formatting. Instead of creating a new column to flag non-numbers, you can use the formula =NOT(ISNUMBER(A2)) in a conditional formatting rule to highlight all non-numeric cells in red automatically.
If you are dealing with cells that might contain errors (like #N/A or #DIV/0!), be aware that ISNUMBER will return FALSE for these. If your goal is specifically to ignore errors but keep numbers, you might consider using IFERROR in conjunction with your logic to provide a cleaner fallback value.
For advanced users, you can nest multiple IF statements. For example, if you want to check if a cell is a number, and if it is, check if that number is greater than 100, you would write: =IF(ISNUMBER(A2), IF(A2>100, "High", "Low"), "Not a Number"). This creates a tiered validation system that cleans and categorizes data in one step.
Troubleshooting
The formula returns FALSE/"Check Data" but the cell looks like a number: This is almost always due to the data being formatted as text. To fix this, select the column, go to the Data tab, select Text to Columns, and simply click Finish. This forces Excel to re-evaluate the data type of every cell in the selection, usually converting "text-numbers" back into actual numbers.
The formula returns #VALUE!: This typically happens if the "True" part of your IF statement is trying to perform math on a cell that isn't actually a number, despite the ISNUMBER check. Double-check that your parentheses are closed correctly. If you have =IF(ISNUMBER(A2), A2*10 without the closing parenthesis for the IF, Excel may struggle to parse the logic.
The formula is not updating when I change the cell value: Check your Calculation Options. Go to the Formulas tab > Calculation Options and ensure Automatic is selected. If it is set to Manual, the IF(ISNUMBER()) result will not change until you press F9.
Frequently Asked Questions
Does ISNUMBER recognize currency or percentages?
Yes. Currency and percentages are simply numbers with specific formatting applied to them. ISNUMBER ignores the formatting and looks at the underlying value, so it will return TRUE for $50.00 or 50%.
Can I use this to find empty cells?
No, ISNUMBER returns FALSE for empty cells. If you specifically need to find blanks, use the ISBLANK function. If you want to check if a cell is either a number or blank, you would use =OR(ISNUMBER(A2), ISBLANK(A2)).
Will ISNUMBER work with scientific notation?
Yes, numbers written in scientific notation (e.g., 1.05E+05) are recognized as numbers by Excel and will return TRUE.
What is the difference between ISNUMBER and checking if a cell is > 0?
Checking if a cell is > 0 will return an error if the cell contains text. ISNUMBER is a "safe" check; it returns a simple TRUE or FALSE regardless of what is in the cell, preventing the rest of your formula from crashing when it hits a text string.
Can I use this in Google Sheets?
Yes, the syntax for IF and ISNUMBER is identical in Google Sheets as it is in Microsoft Excel.