Handle a mixed column gracefully — format numbers one way, label text another. ISNUMBER and ISTEXT let one formula branch on the cell’s data type.
The example
A mixed column routed by type.
| A | B | |
|---|---|---|
| 1 | Cell | Handled as |
| 2 | 42 | Number |
| 3 | abc | Text |
The formula
Branch on the type:
How it works
IS-functions classify the cell:
ISNUMBER(A2)is TRUE for numbers (and dates);ISTEXT(A2)for text.- Nest them in IF to route: do one thing for numbers, another for text, a fallback for blanks.
- This avoids errors — e.g. only multiply numeric cells, only UPPER text cells.
- Other testers:
ISBLANK,ISLOGICAL,ISERROR— same pattern for those types.
One function for all: TYPE(A2) returns a code (1 number, 2 text, 4 logical, 16 error) you can SWITCH on. The IS-function approach is more readable for two or three branches.
Try it: interactive demo
Type a value (number or text).
Variations
Only act on numbers
Guard math:
TYPE + SWITCH
Code-based:
Flag non-numbers
Audit:
Pitfalls & errors
Dates are numbers. ISNUMBER is TRUE for dates and times — usually fine, but be aware.
Numbers stored as text. ISTEXT is TRUE for a “number” typed as text — which is exactly how you catch them.
Blanks. An empty cell is neither number nor text — handle it in the fallback branch.
Practice workbook
Frequently asked questions
How do I do different things for text vs numbers in Excel?
How do I only apply math to numeric cells?
Is there a single function that returns the type?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class