1. Calculation functions
  2. All Functions
  3. Text functions
  4. LENGTH

The LENGTH (or LEN) function returns the number of characters in a text string.

For example, you can use LENGTH to determine if a string is within the character limit for another system.

Syntax

LENGTH(Text to evaluate)

Arguments

ArgumentData typeDescription
Text to evaluateTextThe text to evaluate the number of characters within. The LENGTH function returns the number of characters as a number.

The LENGTH function returns a number.

Syntax example

LENGTH(Customer comments)

In this example, the LENGTH function returns the number of characters for each value of the text-formatted Customer comments line item.

Additional information

Behavior with spaces and blank values

When the Text to evaluate argument contains whitespace characters, each of these are counted as a single character by the LENGTH function.

If a value for the Text to evaluate argument has no characters, the LENGTH function returns a value of zero.

The LEN function

Instead of LENGTH, you can use LEN. The LEN function is functionally identical to the LENGTH function except for its name.

Constraints

For some unicode symbols outside the Basic Multilingual Plane the LENGTH function returns 2 for a single character. For example, text values that are encoded as a combination of two characters (a base character and accent), or emoji.

Excel equivalent

Related Anaplan functions

Examples


Jan 21Feb 21Mar 21
Profit CommentaryThe profit in January was slightly below target, possibly due to the supply chain issue.The profit in February was on target.The profit in March surpassed the target due to the new campaign.

Commentary Length

LENGTH(Profit Commentary)

883765

Within character limit for reports?

Commentary Length < 70


In this example, a module contains information about profit for each month. Time displays on columns, and line items on rows.

The text-formatted Profit Commentary line item contains manually entered text about the profit each month. The number-formatted Commentary Length line item uses the LENGTH function to return the number of characters in Profit Commentary as a number. The Boolean line item Within character limit for reports? then uses the result of Commentary Length and calculates if it's under 70.