Friday, 31 January 2025

TYPE

 The TYPE function in Excel is used to determine the type of value in a cell. It returns a number that corresponds to the type of data:

  • 1 = Number

  • 2 = Text

  • 3 = Logical value (TRUE or FALSE)

  • 4 = Error value

  • 5 = Array

  • 6 = Compound data (not commonly used)

  • 7 = Blank cell (if the cell is empty)

  • 8 = Cell reference (not directly used in TYPE)

  • 9 = Worksheet (not directly used in TYPE)

  • 10 = Formula (not directly used in TYPE)

Below are 10 examples of how the TYPE function works with different data types and formulas:


1. Number

excel
Copy
=TYPE(42)

Result: 1 (Number)


2. Text

excel
Copy
=TYPE("Hello")

Result: 2 (Text)


3. Logical Value (TRUE/FALSE)

excel
Copy
=TYPE(TRUE)

Result: 3 (Logical)


4. Error Value

excel
Copy
=TYPE(#N/A)

Result: 4 (Error)


5. Array

excel
Copy
=TYPE({1, 2, 3})

Result: 5 (Array)


6. Blank Cell

excel
Copy
=TYPE(A1)

If A1 is empty:
Result: 7 (Blank)


7. Formula Returning a Number

excel
Copy
=TYPE(SUM(1, 2, 3))

Result: 1 (Number, because the formula evaluates to a number)


8. Formula Returning Text

excel
Copy
=TYPE(CONCATENATE("A", "B"))

Result: 2 (Text, because the formula evaluates to text)


9. Formula Returning a Logical Value

excel
Copy
=TYPE(1 > 2)

Result: 3 (Logical, because the formula evaluates to FALSE)


10. Formula Returning an Error

excel
Copy
=TYPE(1/0)

Result: 4 (Error, because the formula evaluates to #DIV/0!)


Notes:

  • The TYPE function does not directly return 10 for formulas. Instead, it evaluates the result of the formula and returns the type of that result.

  • If you want to check if a cell contains a formula, you can use the ISFORMULA function (available in Excel 2013 and later).

Example:

excel
Copy
=ISFORMULA(A1)

This will return TRUE if A1 contains a formula, and FALSE otherwise.

No comments:

Post a Comment