What is the TYPE function?
=TYPE(value)TYPE returns a number for the kind of value: 1 for a number, 2 for text, 4 for a logical value, 16 for an error value and 64 for an array.
Column A of the sheet mixes text, numbers, a blank, a logical value, errors and text that looks like a number; column B says what each is. Column C shows the same formula copied down.
TYPE tells apart values that look the same, most usefully numbers and numbers stored as text. When a SUM from pasted data comes out wrong, look for cells where TYPE returns 2 (text).
Arguments
- value
- The value or cell to test.
TYPE examples
Example 1. A number
=TYPE(A3)1.
Example 2. Text
=TYPE(A2)2.
Example 3. An error
=TYPE(A6)16.
Example 4. Kinds of value and their codes
=TYPE(A2)For a cell with a formula, TYPE reports the kind of the result.
Value =TYPE(value) 120 1 (number) "120" 2 (text) TRUE 4 (logical) #N/A 16 (error) {1,2,3} 64 (array) Example 5. Find numbers stored as text
=IF(AND(TYPE(A2)=2, ISNUMBER(VALUE(A2))), "Text number", "")Marks text cells that VALUE can turn into a number.
Common mistakes
Blank cells
A blank cell is treated like the number 0 and returns 1.
Dates
Dates are numbers, so 1.
Checking for formulas
TYPE only reports the kind of result, not whether the cell holds a formula. Use ISFORMULA.
FAQ
- How is it different from the IS functions?
- IS functions say TRUE/FALSE for one kind; TYPE tells you the kind as a number.
- Where is it used?
- To split a calculation by input type, together with CHOOSE or SWITCH.
- How do I show the kind as a word?
- =SWITCH(TYPE(A2), 1, "Number", 2, "Text", 4, "Logical", 16, "Error", "Other").