Welcome to another weekend in the 30XL30D challenge, and you’re probably exhausted from a long week of Excel work, and yesterday’s complicated example for the TRANPOSE function.
Excel T Function
For day 14 in the challenge, we’ll examine the Excel T function
Do We Need It?
The T function is one of the less useful ones. It tests a value for text, and other functions do the same thing, so do we even need T?
To decide, let’s take a look at the T information and examples, and if you have other tips or examples, please share them in the comments.
Function 14: T
The T function returns the text from a value, or an empty string for no text.
How Could You Use T?
The T function has very limited use, and could be replaced by other functions, such as ISTEXT. You can use T to:
- Return text if value is text
- Return an empty string if value is non-text
T Syntax
The T function has the following syntax:
- T(value)
- value can be any value — typed in the formula, or a cell reference
T Traps
The T function returns an error if the value is an error, unlike ISTEXT, which returns FALSE for errors.
Example 1: Test If a Value is Text
I can’t think of a situation where T would be preferable to another function, like ISTEXT. Let’s compare the two functions, side by side, to see the results.
If a value is text, the T function returns that text. In the screenshot below, the T function is used in cell C4, to check the value in cell B4.
=T(B4)
That looks like a number in cell B4, but there’s an apostrophe in front of it, so it’s actually text. The T function returns the “1234” string. In column D, the ISTEXT function also tests the value in cell B4, and returns the result of TRUE.
=ISTEXT(B4)
If the value is a number, as in cell B3, the T function result is an empty string. If you use ISTEXT instead, the result is FALSE.
For error values, the T function result is an error, and ISTEXT returns false.
Download the T Function File
To see the formulas used in today’s examples, you can download the T function sample workbook. The file is zipped, and is in Excel 2007 file format.
No T Function Video
With only one small example, there’s not enough information to make a demo video for the T function, so class is dismissed early today!
_____________
T like N has it’s uses… for ex. suppose we want to return the Text value from A1 if and only if it is Text else Null:
=T(A1)
would give us a Null string if A1 were blank or non-text and it’s a pretty succinct approach given the alternatives:
=IF(ISTEXT(A1),A1,””)
=REPT(A1,ISTEXT(A1))
though it should be noted that of the three the IF is the more robust (underlying errors).
[…] T […]
“If a value is text, the T function returns that text. In the screenshot below, the T function is used in cell C4, to check the value in cell B3.” Do you mean cell C4 checks value in cell B4? Looks like a typo.
Art, thanks for catching that typo, and it’s fixed now.