To check if a cell value is a number or not, you can use IF + ISNUMBER in a combination. In this combination ISNUMBER tests if a value is a number or not and returns the result as TRUE and FALSE. After that, IF uses that TRUE or FALSE to return a meaningful value in the result.
Formula to Test IF a Cell Value is a Number
To write this formula you can use the below steps.
- First, enter the IF function of a cell.
- After that, in the first argument of the IF (logical_text) enter the ISNUMBER function.
- Next, in the ISNUMBER function, refer to the cell where you want to test the number.
- Now, in the [value_if_true] argument, enter Yes, and in the [value_if_false] argument, enter No. You can also use some other meaningful values if you need.
- In the end, enter the closing parentheses and hit enter to get the result.
The moment you hit enter it returns YES or NO according to the value that you have in the referred cell.
How Does This Formula Works?
As I said, in this formula we have two functions, IF + ISNUMBER. In cell A2, you have a number that’s why you have TRUE in the result by the ISNUMBER.
Now we have TRUE, which is why IF returns YES in the result for the value that you have in cell A2.
=IF(ISNUMBER(A1),"Yes","No")
Same Formula in Mac
If you use Excel for Mac, the formula will be the same and can be written using the same functions.
Excel stores a date as a number. And when you have a date in a cell, this ISNUMBER will treat that date as a number and return TRUE in the result. I’m trying to find a solution to this problem, still not able to differentiate between a number and a date while using this formula.