Difference between revisions of "Documentation/How Tos/Calc: TYPE function"
From Apache OpenOffice Wiki
< Documentation | How Tos
m |
(added: return value 64; issue of Excel having no return value 8) |
||
Line 7: | Line 7: | ||
<tt>'''TYPE(value)'''</tt> | <tt>'''TYPE(value)'''</tt> | ||
− | : Returns the type of value as a number: <tt>'''1'''</tt> = number, <tt>'''2'''</tt> = text, <tt>'''4'''</tt> = logical value, <tt>'''8'''</tt> = formula, <tt>'''16'''</tt> = error value. | + | : Returns the type of value as a number: <tt>'''1'''</tt> = number, <tt>'''2'''</tt> = text, <tt>'''4'''</tt> = logical value, <tt>'''8'''</tt> = formula, <tt>'''16'''</tt> = error value, <tt>'''64'''</tt> = inline array. |
: 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. | ||
Line 18: | 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>. | ||
+ | |||
+ | <i>Advanced topic:</i> | ||
+ | |||
+ | <tt>'''TYPE({3;5;7})'''</tt> | ||
+ | : returns <tt>'''64'''</tt> | ||
+ | |||
+ | === Issues: === | ||
+ | * Calc returns <tt>'''8'''</tt> for a formula. Excel returns the type of the formula's returned value; it has no return value to recognise a formula. | ||
{{Documentation/SeeAlso| | {{Documentation/SeeAlso| |
Revision as of 20:42, 23 July 2010
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 = inline 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 topic:
TYPE({3;5;7})
- returns 64
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.