You can use Excel TYPE Function to check the type of value from a cell. In simple words, it will return that what type of a data captured in a cell.
Excel type function is helpful when a function is dependent on the value type of a cell.
In the below example, I have used type function check which type of value is entered in a cell. For a value which is a number, it has returned 1 & for a value which is text, it has returned 2.
TYPE will return 5 different numbers in the result depending on the type of values from a cell. Following are the codes which can be returned by type function against the values from a cell.
|123||1||Return number 1 when a value is a NUMBER.|
|ABC||2||Return number 2 when a value is a TEXT.|
|TRUE||4||Return number 1 when the value is a LOGICAL VALUE.|
|#N/A||16||Return number 1 when value is an ERROR.|
|ARRAY||64||Return number 1 when a value is an ARRAY.|
- value Reference of a cell or a value for which you want to test the type.
Additional Information on Type Function
- When you test value from a cell which has a formula, Type function will test the value return by that formula.
- If you refer to a cell which is blank, it will return number 1 as a result.
- If you refer to a cell which contains date it will return 1 in a result as a date has a value in number.
In the below example, we have used TYPE Function with IF Function. This formula will return the message “Enter Valid Quantity” if the user enters a value other than a number.
=IF(TYPE(F3)<>1,”Enter Valid Quantity”,E3*F3)
To learn more about Excel TYPE Function you can check Microsoft’s Help Section. And, if you have a unique idea to use it, I would love to hear from you.