Arte SheetsLearn. Try. Understand.

Information

TYPE function: classify any cell into numeric codes 1, 2, 4, or 16

Branch on cell data types in one SWITCH expression using TYPE codes (1 = Number, 2 = Text, 4 = Logical, 16 = Error).

Replace chained ISNUMBER / ISTEXT / ISLOGICAL checks

Instead of nesting four separate IS* functions, TYPE(value) returns an integer code describing the evaluated value's data type: 1 for numbers (including dates and empty cells coerced to 0), 2 for text, 4 for logical booleans, and 16 for any error value.

Pairing TYPE with SWITCH produces a human-readable data-type diagnostic column in a single step.

Sample (A)Stored Value (B)TYPE(B)Diagnostic Label
Price2001Number
RegionNorth2Text
ActiveTRUE4Logical
Broken=1/016Error

Map TYPE codes with SWITCH

SWITCH(TYPE(B2), 1, "Number", 2, "Text", 4, "Logical", 16, "Error", "Other") labels every scalar type cleanly, even when B5 holds #DIV/0! (because TYPE absorbs the error and returns 16).

=SWITCH(TYPE(B2), 1, "Number", 2, "Text", 4, "Logical", 16, "Error", "Other")

TYPE never propagates errors—it returns 16

Calling TYPE(1/0) safely evaluates to 16 rather than crashing the audit formula with #DIV/0!.

=TYPE(B5)

Try the example

Use the original values or change them to test your understanding.

Further reading