
Return a numeric code that tells you the data type of a value.
TYPE returns a numeric code that tells you the data type of a value. Instead of giving you TRUE or FALSE for one specific test, it gives you a broader classification in one result.
Microsoft documents these core codes: 1 for number, 2 for text, 4 for logical value, 16 for error, 64 for array, and 128 for compound data. That makes TYPE useful when a formula can receive different kinds of input and you need to react differently to each one.
Classifies a value with a numeric code instead of a simple yes or no result.
The result is a code such as 1, 2, 4, 16, 64, or 128.
=TYPE(value)
You can use a direct value, a formula result, or a cell reference.
| Function | Main job | Use it when |
|---|---|---|
TYPE |
Returns a detailed type code | You need broader classification in one formula. |
ISNUMBER |
Checks for numbers only | You only care whether something is numeric. |
ISTEXT |
Checks for text only | You only care whether something is text. |
ISLOGICAL |
Checks for logical values only | You only care whether something is TRUE or FALSE. |
This function is helpful when one formula can receive mixed input. Instead of stacking several IS... functions, you can call TYPE once and switch behavior based on the returned code.
One nuance matters here. A blank cell reference returns 1, which is the same code used for numbers. That can surprise people if they expect blanks to get their own separate code.
A normal number returns code 1.
=TYPE(A1)
Check the type code of 100 in A1. Formula: =TYPE(A1).
A blank cell reference still returns 1 here.
=TYPE(B2)
Check the type code of a blank cell in B2. Formula: =TYPE(B2).
Error values return code 16.
=TYPE(D1)
Check the type code of #N/A in D1. Formula: =TYPE(D1).
Arrays return code 64.
=TYPE({1,2,3})
Check the type code of an array constant. Formula: =TYPE({1,2,3}).
TYPE classifies a value with a numeric code.Tell your friends about this post