TYPE function
TYPE returns a code for the kind of data in a value: 1 for number, 2 for text, 4 for logical, 16 for error and 64 for array.
Example
Read it as a sentence: check what kind of value F1 holds, where 1 means a number, which gives 1.
Excel shows 1
F
1
Data
Syntax
TYPE(value)
-
value(required) - The value to classify.
Returns: 1 number, 2 text, 4 logical, 16 error, 64 array.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=TYPE(5) | 1 | Number |
=TYPE("a") | 2 | Text |
=TYPE(TRUE) | 4 | Bool |
=TYPE(1/0) | 16 | Error |
=TYPE({1,2}) | 64 | Array |
=TYPE(LAMBDA(x,x)) | 128 | Lambda |
=TYPE(Data!F1) | 1 | Blank |
=TYPE(Items!B1:C2) | 64 | Range |
The Data sheet these formulas read
A cell that starts with = holds that formula.
F
1
Data
The Items sheet these formulas read
B
C
1
Item
Category
2
Boxer cartridge
Tools
Items
Watch out for
- TYPE of a cell holding a formula checks the result, not the formula.
Where it works
- Excel
- TYPE is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Information functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .