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.


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.

TYPE(D1), where D1:D2 contain the array formula {={4;2}}

returns 8. Here the result is for D1's content, which although part of an array is not the array itself.


Application:

Scenario

Imagine you have a table storing customer feedback on a new product. The feedback is collected through a web form, and the "Value" column is a free-form input. Customers can enter text, a rating (number), or even a date. You need to analyze this data and categorize it based on the type of feedback received.

CustomerFeedback Table

Feedback ID

Customer ID

Feedback Type

Feedback Value

A
B
C
D
1
101
5001
Rating
4
2
102
5002
Comment
The product is great!
3
103
5003
Bug Report
7.5
4
104
5004
Suggestion
Add more colors.
5
105
5005
Rating
5
6
106
5006
Comment
Could be faster.
7
107
5007
Bug Report
Error code 404

Applying the TYPE function

To understand the kind of data in the FeedbackValue column, you can use the TYPE function. The result of applying the TYPE function to the Feedback Value column would be:


1 for Number, 2 for Text

Result Table

Feedback ID

Feedback Value

Type

Description

A
B
C
D
1
101
4
1
A numerical rating.
2
102
The product is great!
2
A text comment.
3
103
7.5
1
A numerical bug severity score.
4
104
Add more colors.
2
A text suggestion.
5
105
5
1
A numerical rating.
6
106
Could be faster.
2
A text comment.
7
107
Error code 404
2
A text bug description.




This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof