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

 Argument Data type Description Text to evaluate Text The 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.

### 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.

## Calculation engine functionality differences

In Polaris, the LENGTH function behaves as expected with all text values, including those that contain composite characters or characters from outside the Basic Multilingual Plane (BMP).

In the Classic Engine, the LENGTH function considers the length of:

• Unicode characters from within the BMP to be 1
• Unicode characters from outside the BNP to be 2
• The length of composite characters (such as those with accents or diacritic marks) to be equal to the number of components

## Examples

 Jan 21 Feb 21 Mar 21 Profit Commentary The 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) 88 37 65 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.

Disclaimer

We update Anapedia regularly to provide the most up-to-date instructions.