How To Use The T Function In Google Sheets

Reading Time: 4 minutes

The T function is used to test whether the value provided is a text.

Syntax
=T(value)

value – The string to test.

Sample Usage
=T("Rachel Adams") //Returns the value as the output – Rachel Adams.

=T("8742") //Returns 8742 as a text string.

Sample Google Sheets template with formula here.

The T function is used to test whether the value provided is text or not. If the value is found to be a text, the T function returns the value as it is, however for any other data type, the T function produces a null string.

Often when collecting data from a survey, some people put in fake data by inputting numbers when asked for their names. The T function in Google Sheets can be used in such situations to filter the data to ensure that only reliable information remains while the fake data is cleared. 

The table below summarizes the output that is produced when we use the T function in Google Sheets.

Different types of inputs and their outputs produced using the T function in Google Sheets
Summary of outputs produced by the T function

You can make a copy of this spreadsheet and follow along with the tutorial. It contains all the examples and the formulas used.

Formula to use the T function in Google Sheets

The syntax to use the T function in Google Sheets is as follows:

=T(value)

The T function takes only one compulsory argument. The argument may represent any manual input or a reference to a cell comprising the data.

In case the argument is a text, the function returns the argument itself otherwise the function returns a blank white cell.

Let’s look at the different types of values and their output when used with the T function in Google Sheets.

Case 1: Using Text as an argument

When using text as an argument, the T function returns the text as it is.

Using text as an argument in the T function

The use of “ “ inside the parentheses implies that the value enclosed is in text format. Since the T function checks for text input and returns the text if it’s a string, the value enclosed is produced as output as it is.

Case 2: Using numbers as an argument

Number inputs don’t qualify as a string unless they are manually specified so like in the next case. Hence, when using numbers in the T function in Google Sheets, no text is found so the function returns a blank cell as the output.

Using numbers in the T function

Sometimes you’ll also find that numbers are inputted as a string in Google Sheets. An easy way to distinguish it would be by noticing the alignment of the data in the cell. If the number is aligned to the left, it’s text input. On the other hand, if it’s not aligned to the left, it’s a number input. 

Two ways a number can be inputted in Google Sheets

To input a number as text, simply put a single inverted comma (‘) before the value. 

What happens when we use a number which is inputted as a text in the T function in Google Sheets? Let’s find out below.

When a number is inputted as a text

When the numbers are formatted as text, using the T function in Google Sheets returns the number itself in the same format as shown above.

Case 3: Using date or time as an input

The T function in Google Sheets considers date and time as numbers hence return a blank cell when used as arguments in the function as shown below.

Using date and time as an input

You can notice that manually inputting the date as time is not accepted when trying to use the T function in Google Sheets and results in the Formula Parse error. To know more about error messages click here.

Case 4: Using logical values or error values as input

The T function only recognizes error messages as valid strings of text and displays the same when used. On the contrary, logical values such as true and false are not recognized as text and result in a blank cell when used in the T function.

Using logical value or error messages as input

Conclusion

To conclude, the T function in Google Sheets can be a very quick and useful function to use in order to differentiate the text inputs from the non-text ones. The next time you clean the spam data from the surveys make sure to use the T function in Google Sheets.

To explore more such formulas, head to our blog.

See Also

How to split text into columns in Google Sheets

Translate function in Google Sheets

Use left and right functions in Google Sheets

How to fix Formula Parse errors in Google Sheets