Information

TYPE Formula

TYPE returns a number indicating the data type of a value: 1 for number, 2 for text, 4 for logical, 8 for formula (only in arrays), 16 for error, and 64 for array. It is useful for building type-aware logic and debugging unexpected data types.

Syntax

TYPE(value)
ParameterDescription
value Parameter of the TYPE function.
Try TYPE in Viztab — free, no signup

Examples

Determine data type

Formula
=TYPE(A1)
Returns 1 if A1 is a number, 2 if text, 4 if TRUE/FALSE, 16 if an error, 64 if an array.

Type-specific handling

Formula
=CHOOSE(TYPE(A1), A1*2, UPPER(A1), IF(A1,"Yes","No"), "", "Error")
Doubles numbers, uppercases text, converts booleans to Yes/No. CHOOSE routes to the right handler based on TYPE result.

Find non-numeric cells

Formula
=IF(TYPE(B2)<>1, "Not a number", "")
Flags cells that aren't numbers. More granular than ISNUMBER because TYPE tells you exactly what the value IS.

Common Errors

#VALUE!

TYPE itself does not error — it returns a valid number for any input, including error values (returns 16 for errors).

Tips

Type codes

1=Number, 2=Text, 4=Logical (TRUE/FALSE), 8=Formula, 16=Error, 64=Array. Number includes dates since dates are stored as numbers.

Cannot distinguish dates from numbers

Both dates and numbers return TYPE=1. Dates are just formatted numbers internally. There is no built-in way to detect date type specifically.

Handles errors gracefully

Unlike most functions, TYPE doesn't propagate errors. TYPE(#DIV/0!) returns 16, not #DIV/0!. It is one of the few functions that can examine errors without triggering them.

Try TYPE in Viztab

Import your data and use TYPE with 370+ other formulas. No signup required.

Open Viztab

Related Formulas