Documentation/How Tos/Calc: TYPE function

From Apache OpenOffice Wiki
< Documentation‎ | How Tos
Revision as of 12:25, 24 July 2010 by Drking (Talk | contribs)

Jump to: navigation, search


TYPE

Returns the type of value (number, text, etc.).

Syntax:

TYPE(value)

Returns the type of value as a number: 1 = number, 2 = text, 4 = logical value, 8 = formula, 16 = error value, 64 = array.
If a cell contains both an error and a formula, 16 (error value) is returned.
A blank cell is classed as a number here, and 1 is returned.

Example:

TYPE(C2)

where cell C2 contains dog returns 2, because dog is text.

TYPE(C3)

where cell C3 contains =NA() returns 16, because NA() returns the error value #N/A.

Advanced topics:

TYPE({3;5;7})

returns 64

{=TYPE(A1:B1)} entered as an array formula in cells A3:B3

returns 64 in cells A3:B3 (whatever the contents of cells A1 and B1), as A1:B1 is an internal array in the array formula.

TYPE(A1:B1) entered as a normal formula in both cells A3 and B3

returns TYPE(A1) in cell A3, and TYPE(B1) in cell B3. Here Calc finds the row/column intersection of the formula cell with range A1:B1, to determine a reference to the single cell to examine. For more information, see Using arrays.

Issues:

  • Calc returns 8 for a formula. Excel returns the TYPE of the formula's returned value; it has no return value to recognise a formula.

Template:Documentation/SeeAlso

Personal tools