You are learning IF function in MS Excel
How do I write an IF statement to check if a cell is empty, contains text, or has a number?
Here's how you can write an IF statement to check if a cell is empty, contains text, or has a number in Excel:
Using a combination of ISBLANK, ISTEXT, and ISNUMBER functions:
```excel
=IF(ISBLANK(A1), "Empty", IF(ISTEXT(A1), "Text", "Number"))
```
Explanation:
1. ISBLANK(A1): This part checks if cell A1 is empty. If it is, the formula returns the text "Empty".
2. ISTEXT(A1): If cell A1 is not empty, this part checks if it contains text. If it does, the formula returns the text "Text".
3. ISNUMBER(A1): If cell A1 is not empty and doesn't contain text, then it must be a number. In this case, the formula returns the text "Number".
Alternatively, using a nested IF statement:
```excel
=IF(ISBLANK(A1), "Empty", IF(ISTEXT(A1), "Text", ISNUMBER(A1)))
```
Explanation:
This formula works similarly to the previous one, but with slightly different nesting. It first checks for an empty cell, then checks for text, and finally checks for a number. If none of the conditions are met, the formula will return FALSE by default.
Customizing the Output:
You can customize the text returned by the formula to better suit your needs. For example, instead of "Text", you could return "Text data" or a specific message depending on the type of text found.
Remember to replace "A1" with the actual cell reference you want to check.