TYPE Function

Excel 2007+

Summary

The Excel TYPE function identifies the data type of a value, returning a numeric code that indicates whether the value is a number, text, logical value, error, array, or compound data. This is essential for dynamic formulas that behave differently based on input types.

Syntax

TYPE(value)

Parameters

Parameter Type Required Description
value Any Yes The value whose type you want to determine. Accepts numbers, text, logical values, errors, arrays, or cell references.

Using the TYPE Function

TYPE is invaluable in advanced Excel formulas where functions need to adapt based on data types. Use it to create flexible formulas that handle mixed data types gracefully, or to debug formulas by identifying unexpected data types.

Common TYPE Examples

Basic Data Type Detection

=TYPE(A2)

Returns 2 if A2 contains text 'Smith', indicating text data type.

Text Concatenation Type Check

=TYPE("Mr. "&A2)

Returns 2, confirming the concatenated result is text.

Error Value Detection

=TYPE(2+A2)

Returns 16 when A2 contains text, identifying the #VALUE! error type.

Array Type Identification

=TYPE({1,2;3,4})

Returns 64 for array constants.

Frequently Asked Questions

1=Number, 2=Text, 4=Logical, 16=Error, 64=Array, 128=Compound data.

No, TYPE identifies the resulting value type, not whether a formula exists.

Yes, it returns the type of the displayed value in the referenced cell.

Common Errors and Solutions

#VALUE! error

Cause: Invalid value argument

Solution: Ensure value parameter contains valid Excel data

Unexpected return code

Cause: Resulting value type differs from expectation

Solution: Check the actual data type using the TYPE return codes reference

Notes

  • TYPE cannot distinguish between formula cells and value cells
  • Use with functions like IF, CHOOSE, or custom UDFs that require type awareness
  • Array return code (64) applies to both constant arrays and dynamic arrays
  • Compound data (128) typically appears with certain advanced functions

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in:

Content last reviewed: December 11, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+