Following the “IS” functions theme, we have the ISTEXT function. This function doesn’t check for errors, but if the value is of a specific type. In this case, if the value is “Text” or not. As with all the other “IS” functions, this one will return only TRUE or FALSE.
Usage
It follows a simple pattern.
- Value
To demonstrate how this works, let’s look at the following table:
The “ISFUNCTIONS” is defined as follows:
=ISTEXT([text])
What do you think the result will be to the last row? Will “123” be TRUE or FALSE?
Let’s check the result:
Since the column is defined with Type “single line of text,” even if you store an apparent number, it will be stored as text so that the function will return TRUE. But notice the first 2 columns. They are empty so that the function will return FALSE.
Limitations
It’s not actually a limitation, but it’s something to know and be aware of. If the column is empty, the “ISTEXT” function will return FALSE. It’s only text if there are some values there.
Be careful with numbers. If you want to store them, use a column of type “Number” instead; otherwise, they will be considered text.
Recommendations:
- Don’t use this function to check if the column is empty or not. Although the result may be the same, you may find edge cases where they differ. And you have the “ISBLANK” function to do this.
- Since SharePoint works with columns, you can create hidden “validation” columns with the functions validating the data. After that, you can expose to the user the “message” columns that have useful error messages or actions that they can take to solve the problem.
- Always deal with errors. Leaving them for the user to see is horrible, but also you can bring trouble to your own code. If you don’t validate a column, it can be used after other calculations, and the error will cascade. You can have an error in one column, and the issue could be in whole different columns, so deal with issues where they happen.
- Don’t nest error checking. There’s no real reason to do it, but if you find yourself in a situation where you have nested ISTEXT functions in a formula, you should check it carefully because you’re probably doing something wrong.
- Please note that formulas may have localization-based differences. For example, you should write “ISTEXT” with “separating each of the arguments, but if your regional settings are set to Portugal, you should use “;” instead.
Sources:
Microsoft’s ISTEXT Function Reference
Introduction to SharePoint formulas and functions
Back to the SharePoint’s list formula reference.
Photo by Marija Zaric on Unsplash