TYPE Function - Excel
Overview
The TYPE function in Excel is a useful tool for checking the data type of a specified cell. This function will return a numeric value when given a variety of inputs, except for a cell that contains a formula.
If the value is a number value it will return 1.
If the value is a text value it will return 2.
If the value is a logical value it will return 4.
If the value is an error value it will return 16.
If the value is an array value it will return 64.
If the value is compound data it will return 128.
Example:
=TYPE("Apple")
Syntax:
=TYPE(value)
value
: This is the value or expression that you want to check the data type for.
Example: number
In this example, the TYPE function gives a 1 result because C2 equals 10 and that is a number data type.
Example: text
In this example, the TYPE function gives a 2 result because C2 equals “Apple” and that is a text data type.
Example: logical
In this example, the TYPE function gives a 4 result because C2 equals “TRUE” and that is a logical data type.
Example: error
In this example, the TYPE function gives a 16 result because C2 equals “#REF!” and that is an error data type.
Example: array
In this example, the TYPE function gives a 64 result because C2 equals “{1,2;3,4}” and that is an array data type.