How to use the T function
What is the T function?
The T function returns a text value if the argument is a text value.
The T function in Excel is rarely needed to convert values in formulas. Excel automatically handles conversion of numbers, text, logical values, and error values as required. T is provided for compatibility with other spreadsheet applications. In most cases, Excel will format values correctly without requiring the T function.
Only use T if you find Excel is not properly converting a value to text in a specific formula. In general, you can avoid using it entirely since Excel auto-converts types seamlessly in most situations.
How does Excel handle values?
Excel changes the position of the value in a cell based on the value type. For example:
- Cells B2 and B8 contain text values that are aligned left.
- Cell B3 contains a number that is right aligned in the cell.
- Cell B4 contains a date, which Excel handles as a number. The date is right aligned.
- Cells B5 and B6 contain boolean values, which are automatically centered in the cell.
- Cell B7 contains an error value, which is also centered.
Note, the user may have changed the cell formatting making these guidelines useless. To revert back to default settings check that the align buttons are not selected:
- Align left
- Center
- Align right
What is the difference between the T and N function?
The T function deletes numbers and dates, the N function removes text values.
What other functions let you identify/format/convert values?
ISTEXT function | TEXT function | VALUETOTEXT function
Table of Contents
1. T Function Syntax
T(value)
2. T Function Arguments
value | Required. The value you want to evaluate. |
3. T Function example
The T function in cell C3 contains a cell reference to cell B2. B2 contains a number, the T function returns "" which is nothing.
Formula in cell C3:
Cell B4 contains a date, Excel dates are actually numbers and numbers return "" which is nothing. Cells B5 and B6 are TRUE and FALSE respectively, the T function returns "" for both these values.
Cells B7 and B8 contain an error value and a text value, the T function returns both values.
In summary, the T function returns a value if it is text and nothing if the value is a number, date or boolean value.
4. T function not working
The above image shows that the T function returns numbers, dates and boolean values, why does that happen? Select these cells to evaluate the values in the formula bar.
The apostrophe character converts numbers, dates and boolean values to text values, there is no way to tell unless you select one of the values and examine the formula bar.
Other errors
The #NAME error appears if the function name is misspelled.
Other errors may have their origin in the source data. Check the source data for errors.
Can I use the T function in an array formula?
No, it returns only the first value in an array. The example above demonstrates that the T function returns an empty text string ("") because the first value in the cell range B3:B8 is 23. Since 23 is a number, the T function converts it to an empty text string.
Useful links
T Function - Microsoft support
T Function
Functions in 'Text' category
The T function function is one of many functions in the 'Text' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form