LEN() Function in SharePoint Calculated Column (Examples + Video)

Recently, I worked on a SharePoint project where I needed to calculate the length of a SharePoint list column. We can achieve this using a SharePoint calculated column.

Basically, the LEN() function in SharePoint can be used to calculate the length of a string. This is useful when you want to get the total number of characters in a specified string.

SharePoint calculate column LEN() function

Syntax:

= LEN([Column Name])

Parameters:

  • Column Name – Take the text string column for which you want to find the length of characters.

Output Returned:

  • It will return the integer that represents the count of characters for a specific string.

Additional Note:

  • The LEN() function will also count spaces as characters. So, if a text string consists of spaces at the beginning or end of a string, or spaces in between words, these were also considered as one character.

Limitations:

Though it indicates that we should provide a text string, LEN() will not generate an error for other types.

  • If we apply LEN () for the Yes/ No column, it will return the output as 4 for “Yes” and 5 for ”No.” But, it should have to be 3 for “Yes” and 2 for “No”. This is because [Yes/No] will be stored as [True/False] internally.
  • It does not support the Location column, but it can apply to each value.

Check out SharePoint Calculated Column Date Examples

SharePoint Calculated Column LEN() Examples

Below, you can see a couple of examples related to the LEN() function in a SharePoint calculated column.

Example 1: Get the Length of a SharePoint List Column in a Calculated Column

Suppose you have a SharePoint list “Event Registrations List” with the following columns in a table. And, you want to quickly know the total number of characters in the list column, i.e, for example: Event Name.

Column NameColumn Type
Event NameTitle – Renamed to Title column
Event DateDate and Time column
SharePoint Lists calculated Column Len Function

You can use the following function:

=LEN([Event Name])

Here are the steps to create a calculated column in a SharePoint list:

  1. Open your SharePoint list/ library, where you want to add the calculated column. Click on + Add column. Select See all column types. Then, click the Next button.
SharePoint calculated column string length
  1. Next, it will redirect to the Create Column page, where you can create or add a column to your SharePoint list.
  2. On the Create Column page, provide a name for a column and choose the data type as Calculated (calculation based on other columns).
Get Length of a SharePoint list Column in a Calculated Column
  1. Enter the following formula in the Formula box. Choose the data type returned from this formula to ” Number“. Click on OK at the bottom of the page.
=LEN([Event Name])
SharePoint calculated column length
  1. Now, return to your SharePoint list to view the newly created calculated column. It will display the length of a string [Event Name]. You can have a look at the reference image:
Use LEN() Function in SharePoint Calculated Column

Check out SharePoint Calculated Column Round Up to Decimal Places

Example 2: SharePoint Calculated Column – Check Length of a String

For this example, I will use the same SharePoint list as in Example 1.

In the SharePoint list “Event Registration,” I wanted to check the length of a string from a SharePoint list column [Event Name].

Which means that the Event name should be below 50 characters. If it is greater than 50 characters, it should display “Invalid;” otherwise, it should display “Valid.”

SharePoint calculated column LEN formula

Here are the steps to follow:

Follow the steps below:

  1. On the Create Column window, provide a name for the column and select the type as Calculated (calculation based on other columns).
SharePoint calculated column LEN function
  1. Copy and paste the below given formula in the Formula box. Select the data type returned from this formula to “Single line of text”. Click on the OK button.
=IF(LEN([Event Name])<50,"Valid","Invalid")

Replace the [Event Name] with your column name from the Insert box.

SharePoint calculated column check string length
  1. Now, the calculated column has been created.
  2. Open your SharePoint list. The calculated column will display the output as Invalid and Valid. Have a look at the image below:
Check the length of a SharePoint list column in a calculated column

SharePoint Calculated Column LEN() Function – Video Tutorial

In this tutorial, I explained how to use the LEN() function in a SharePoint calculated column with two examples.

You may also like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…