The T function in Google Sheets is a versatile tool designed to return string arguments as text. It effectively handles various data types, ensuring consistent text output even when different kinds of data are input. This function is particularly useful in cases where you want to force certain values to be treated as text, providing a seamless experience when manipulating and presenting data in spreadsheets.
Syntax
T(value)
- value: This parameter represents any value or expression that you wish to evaluate. If the value is text, it will be returned as is; otherwise, it will return an empty string.
Example #1
=T(123)
In this example, the function attempts to convert the number 123 into text but since it’s a number, it returns an empty string. Result: “”
Example #2
=T("Hello, World!")
Here, the T function receives a string input “Hello, World!” and returns it without any alterations. Result: “Hello, World!”
Example #3
=T(A1)
If cell A1 contains a numeric value (e.g., 456), T will return an empty string, since the input is not text. Result: “”
Error handling
- VALUE! – This error occurs when the input is referential or has issues with data type conversion.
- REF! – This error indicates that the function is trying to reference a non-existent cell.
- NUMBER! – This error suggests that the input value is invalid for conversion to text.