In this Power Apps Tutorial, We will see what is the Len function in PowerApps, What are its syntaxes, and its example that how we can use the Power Apps len function.
Also, We will discuss these below topics that are related to PowerApps Len Function as:
- PowerApps length of string
- PowerApps length of collection
- PowerApps length of table
- PowerApps length of array
- PowerApps length of gallery
- PowerApps minimum length
- PowerApps maxlength error
- PowerApps trial length
Power Apps Len Function
- Power Apps Len function helps to return the length of a string of a text.
- When you will specify a single string as the argument, then the return value is the length as a number.
- When you will specify a blank or empty string, then the Len returns Zero (0).
PowerApps Len Function Syntax
Below represents the syntaxes of Power Apps Len function as:
Len( String )
Where,
- String = This is Required. Specify the string to measure.
Len( SingleColumnTable )
Where,
- SingleColumnTable = This is Required. Specify the single-column table of strings to measure.
Read Power Apps Dropdown Control – How to use
PowerApps Len Function Examples
Example – 1:
- In this example, On the PowerApps screen, there is a text input control named Company. This input control is having a string as “TSInfo Technologies” as shown below.
- Now I would like to find out the length of the string that is present in the input control.

- To do so, apply this below formula on Label’s Text property as:
Text = "Length of the Text: " & Len( Company.Text )
Where,
- “Length of the Text: ” = This is the text that will display in the label control
- Company = Text input control name

- Similarly, if you will pass the empty string in the Label control, then the Len will return the Zero value as you can see in the below screenshot.

Example – 2:
- In this scenario, there is a table named BookAndAuthor. This table contains two columns as BookTitle and Author as shown below.

- The below table represents that how you can use the PowerApps Len function with its descriptions and results.
Formula | Description | Result |
Len( ShowColumns( BookAndAuthor, “Author” ) ) | In the Author column of the BookAndAuthor table. It measures the length of each string. It returns a single-column table that contains the length of the each string. | 13, 9, 10 |
Len( [ “This”, “is an”, “Example”, “” ] ) | In the Value column of the inline table: It measures the length of each string. It returns a single-column table that contains the length of each string. | 4, 5, 7, 0 |
Read: Power Apps Loading Spinner
PowerApps length of string
Do you want to work with the PowerApps Length of string? Refer to this below example.
- In this example, I would like to make the text input field length should be 7 characters. This means the user has to input only 7 characters in that field. Follow this below screenshot.
- In the below screen, If the text input field contains more than 7 or below the 7 characters, then the button will disable mode and a warning message will appear as “Text should be exactly 7 characters“.

- To do so, follow these below steps in PowerApps app:
- Insert a Text input control and set its Default property to a blank value (” “).
- Select the text input control and apply this below formula on its BorderColor property as:
BorderColor = If(
Len(TextInput3.Text) = 7,
RGBA(
0,
18,
107,
1
),
Color.Red
)
Where,
TextInput3 = Text input control name

3. Add a Label control and set its Text property to “Text should be exactly 7 characters”.

4. Select the label control and apply this below formula on its Visible property as:
Visible = Len(TextInput3.Text) <> 7
5. Next, Add a Button input (Rename it to Click me!). Set this below formula on its DisplayMode property as:
DisplayMode = If(
Len(TextInput3.Text) = 7,
DisplayMode.Edit,
DisplayMode.Disabled
)
In this above code, it specifies if the text input field is having with the 7 characters, then only the button will edit mode otherwise it will disable.
Now Save and Preview the app. When you will enter the character till 7, then the button will be in edit mode and clickable, otherwise the button will be in disable mode (with a warning message) as in the below screenshot.

PowerApps length of collection
Here we will see how to work with PowerApps Length function in PowerApps Collection.
- Suppose there is a Powerapps collection and you want to count the total number of records that are present in the collection. That means you will measure the length of the collection.
- The below screenshot represents the PowerApps Collection named EventCollection. Now I would like to find out the length or count the number of records of this collection.

- To do so, Insert a Label control and apply this below formula on its Text property as:
Text = "Length of Collection: " & CountRows(EventCollection)
Where,
- “Length of Collection: “ = Specify the text that will display in the label control
- EventCollection = Collection name

- Once you will save and publish the app, you can see the total number of records in the label control as shown in the above screenshot.
Power Apps length of array
Here we will see how to work with the PowerApps length of array.
- Suppose there is a number of emails of some particular users. And you want to count the number of user emails on the PowerApps screen (by using the PowerApps Count function).
- Insert a Label control and apply this below formula on its Text property as:
Text = CountRows(
Split(
"Bijay@tsinfotechnologies.com;Bhawana@tsinfotechnologies.com;Preeti@tsinfotechnologies.com;Nancy@tsinfotechnologies.com",
";"
)
)
Where,
- Bijay@tsinfotechnologies.com;Bhawana@tsinfotechnologies.com and so on = You need to specify the number of user emails that you need to count.
- Split = This is the PowerApps function that helps you to divide the user email with a delimiter “;”

- Once you will save and publish your app, you can see the result inside the label control as shown in the above screenshot.
PowerApps length of gallery and PowerApps length of table
Are you interested to learn what is the length of the PowerApps gallery and how it works in PowerApps? Similarly, want to know PowerApps length of table, then you can refer to the below PowerApps article:
PowerApps minimum length
Here we will see how to work with the PowerApps minimum length. Lets follow these below scenarios.
Example – 1:
- In this example, I want to disable a button if the text is below 100 characters or over 200 characters.
- On the PowerApps screen, I have a Text input control and a Button input control as shown in the below screenshot.

- Select the Button (Save) and apply this below formula on its DisplayMode property as:
DisplayMode = If(
IsBlank(TextInput1.Text) || IsMatch(
TextInput1.Text,
".*[,\|].*"
) || Len(TextInput1.Text) < 100 || Len(TextInput1.Text) > 200,
DisplayMode.Disabled,
DisplayMode.Edit
)
Where,
TextInput1 = Text input control name

- Now Save and Preview (F5) the app. Enter some text in the text box. If the text is below 100 characters or over 200 characters, then the button will be in disable mode otherwise it will be in edit mode.
Example – 2:
- In this example, I want to make a textbox that can only contain number that are over 50. if they fill in 49 or lower in the textbox, then they must get a message that says the minimum value is 50.
- To do so, Insert a Text Input control to fill in NUMBER only. To make it Number, Select the text input control -> Go to Properties pane -> Select the Format as Number as shown in the below screenshot.

- Next, Add a Label control and set its Text property to “Minimum Value should be 50” as like the below screenshot.

- Select the Label control and apply this below formula on its Visible property as:
Visible = If(
Value(TextInput2.Text) > 49,
true,
false
)
Where,
TextInput2 = Text input control name

- Now save and preview the app. Enter a number as per your choice (like 55). If the value is more than 50, then a warning message will appear as “Minimum Value should be 50” as like the below screenshot.

PowerApps maxlength error
- PowerApps MaxLength property defines the maximum number of characters that the column can hold. You can apply this property only to columns that contain strings.
- Suppose you did not set the maximum length, then it returns a blank value.
- The result type of this PowerApps MaxLength property is a Number.
Syntax:
DataSourceInfo( DataSource, Information, ColumnName )
Where,
- DataSourceInfo = This helps to provide information about a data source.
- DataSource = You need to specify the data source to use.
- Information = This is required that specifies the type of information that you want to retrieve. The information name should be these formats like DataSourceInfo.DisplayName, DataSourceInfo.MaxLength, DataSourceInfo.MaxValue.
- ColumnName = It is optional. You need to provide the column name as a string. Specify the column name including the double-quotes. For information at the data-source level, the ColumnName argument can’t be used.
NOTE:
For SharePoint Data source and Excel Data sources that contain column names with the spaces, specify each space as “x0020“. For example, specify “Employee Name” as “Employee_x0020_Name”.
Example:
- You can apply this below formula on MaxLength property of a String data type card as:
MaxLength = DataSourceInfo(
[@'Event Registration Details'],
DataSourceInfo.MaxLength,
"Title"
)
Where,
- @’Event Registration Details’ = SharePoint List Name
- DataSourceInfo.MaxLength = While you are working with the PowerApps MaxLength property, you need to specify the DataSourceInfo. In some cases, Some PowerApps users are only specifying the MaxLength, that’s why they are getting some errors and also it won’t work.
- “Title” = SharePoint Column name (Single line of text data type)

- To know the maximum length of the Title column, you can insert a Label control and apply this above formula on its Text property.
- Once you will save and preview the app, you can see the label control will display the result value as 255. That means the maximum length of the title column is 255.
PowerApps trial length
- Here the PowerApps Trial Length defines the meaning of PowerApps Trial Plan.
- PowerApps Community Plan and PowerApps Trial Plan, both are free but are created for different purposes.
- PowerApps Community plan helps to access the PowerApps premium functionalities, Dataverse, and Power Automate for individual use.
- PowerApps Plan Trial helps to user plan for 30 days. The PowerApps user can try out the PowerApps, Dataverse, and Power Automate. You can purchase a plan when your trial expires.
- To learn more about PowerApps Plan, Refer to this MSDN article: PowerApps Plans
Also, you may like these below PowerApps tutorials as:
- PowerApps repeating table
- Show hide fields based on dropdown selection PowerApps (2 Examples)
- PowerApps CountIf Function with Examples
- PowerApps Count Function with Examples
- How to Create Tabbed Forms in PowerApps for SharePoint List
- PowerApps First, FirstN, Last, and LastN function with examples
- PowerApps CheckBox – How to use
- PowerApps AddColumns Function with Examples
- PowerApps LastSubmit() with Examples
- PowerApps Patch Function with examples
- PowerApps ForAll Function with examples
- PowerApps Replace Function with examples
- PowerApps if statement with examples
In this PowerApps Tutorial, We saw what is the Len function in PowerApps, What are its syntaxes, and its example that how we can use the len function in Power Apps.
Also, We discussed these below topics that are related to PowerApps Len Function as:
- PowerApps length of string
- PowerApps length of collection
- PowerApps length of table
- PowerApps length of array
- PowerApps length of gallery
- PowerApps minimum length
- PowerApps maxlength error
- PowerApps trial length
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com