Difference between revisions of "Documentation/How Tos/Calc: TYPE function"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m
Line 3: Line 3:
 
== TYPE  ==
 
== TYPE  ==
 
Returns the type of value (number, text, etc.).
 
Returns the type of value (number, text, etc.).
 
  
 
=== Syntax: ===
 
=== Syntax: ===
Line 12: Line 11:
 
: If a cell contains both an error and a formula, <tt>'''16'''</tt> (error value) is returned.
 
: If a cell contains both an error and a formula, <tt>'''16'''</tt> (error value) is returned.
 
: A blank cell is classed as a number here, and <tt>'''1'''</tt> is returned.
 
: A blank cell is classed as a number here, and <tt>'''1'''</tt> is returned.
 
  
 
=== Example: ===
 
=== Example: ===
Line 20: Line 18:
 
<tt>'''TYPE(C3)'''</tt>
 
<tt>'''TYPE(C3)'''</tt>
 
: where cell C3 contains <tt>'''=NA()'''</tt> returns <tt>'''16'''</tt>, because <tt>'''NA()'''</tt> returns the error value <tt>'''#N/A'''</tt>.  
 
: where cell C3 contains <tt>'''=NA()'''</tt> returns <tt>'''16'''</tt>, because <tt>'''NA()'''</tt> returns the error value <tt>'''#N/A'''</tt>.  
 
  
 
=== See also: ===
 
=== See also: ===

Revision as of 13:05, 19 January 2008


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.
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.

See also:

CELL function

Information functions

Personal tools