Power Apps Split Function – How to Use + Examples

Recently, I developed a Power Apps Travel Expenses application. Each travel expense has a unique ID containing the first five numbers from the GUID string.

I had to split the string into individual characters to fetch only numbers from GUID. I achieved this with the Power Apps split function.

In this article, I will explain how to use the Power App split function with various examples. Such as:

  • Split full name into first and last names in the Power Apps gallery
  • Create a collection from a comma-separated string in Power Apps
  • Power Apps split guid string by character and fetch only numbers from it
  • Power Apps split string by a new line
  • Split Email address in Power Apps
  • Power Apps Split date and time with the Concat function
  • Power Apps split a string into rows and columns

Power Apps Split Function

In Power Apps, the Split function is commonly used to divide a string into individual values using the delimiter (separator). The separator can be zero, one, or more characters. This function returns the entire string if the separator is not found in the string.

Look at the syntax of the Power Apps split function.

Split( Text, Separator )
  • Text = Required parameter. Text to split.
  • Separator = Required parameter used to split the string. It can be zero, one, or more characters.

Let’s see the examples of the Power Apps split function.

Example 1: [Split full name into first and last names in Power Apps gallery]

1. In Power Apps, add gallery control and provide the formula below in its Items property.

[
    {Product: "Laptop-Electronics"},
    {Product: "Table-Furniture"},
    {Product: "Shoes-Fashion"},
    {Product: "Phone-Electronics"}
]
Power apps split function

2. Add a text label to the gallery control to display only the first name and provide the formula below in its Text property.

First(Split(ThisItem.Product, "-")).Value

Here,

  • ThisItem.Product = The string to split.
  • “-“ = Seperator.
  • The First () function will fetch only the first word after splitting the string with the “-” separator.
powerapps split string get first value

3. Add another text label to the gallery control to display the last name and provide the formula below in its Text property.

Last(Split(ThisItem.Product, "-")).Value

Here, the Last() function gets last from the split string.

powerapps split string get second value

Example 2: [Create a collection from a comma-separated string in Power Apps]

1. Add a button control in the Power Apps screen from the +Insert tab. Then, provide the formula below for its OnSelect property.

ClearCollect(colEmployess,Split("Liam,Noah,Oliver,James,Elijah,Theodore",","))

Here,

  • ClearCollect() function creates a collection.
  • colEmployess = Collection name.
  • “Liam,Noah,Oliver,James,Elijah,Theodore” = String that contains names.
  • “,” = Separator.
create collection from comma separated string powerapps

2. Save the changes and click the button control while previewing. Then, in the left navigation, click (x) Variables -> Under Collections ->Open the created collection. You’ll see the string provided on the button control split into individual names in the collection.

powerapps split string to collection

Example 3: [Power Apps split guid string by character and fetch only numbers from it]

1. Add a button control to the Power Apps screen and provide the formula below in its OnSelect property.

Set(varDigits,FirstN(Filter(Split(GUID(),""),IsNumeric(Value)),5));

Here, the split function will split each character in the guid string. The IsNumeric() function will check each character from the split string and whether it is a number.

The Filter function only fetches all numbers from the GUID string after splitting it into each character stored in table format. The FirstN() will fetch only five numbers from all the numbers.

powerapps split guid string by character

2. To see the created global variable, click on the (x) Variable on the left navigation -> Under Global variables -> click on ellipses(…) next to the variable -> click on View Table.

powerapps split expected text value

3. Look at the image below; it fetches only five digits from the guide string.

powerapps split table value

Example 4: [Power Apps split string by a new line]

1. Add a Data Table control to the Power Apps screen and add the formula below to its Items property.

Split("Power Apps is a Microsoft Product Allows to Develop Applications"," ")
power apps split string by a new line

2. To add the column -> Open the Properties of the Data Table control -> Click on Fields -> +Add field -> Check Value -> Click Add button.

powerapps split text by new line

3. Now, look at the table; each word in the given sentence is placed in a new line in the Power Apps data table control.

powerapps split string by delimiter into rows

Example 5: [Split Email Address in Power Apps]

1. Add the formula below in the Data Table controls Items property.

Split("Patti@szg65.onmicrosoft.com","@")
powerapps split email address

2. To split the email address with the dot(.) separator, place the formula below in the Items property of the data table control.

Split("Patti@szg65.onmicrosoft.com",".")
power apps split email

3. To split the email address by taking multiple characters as a separator, use the below formula.

Split("Patti@szg65.onmicrosoft.com","szg")
split email address power apps

Example 6: [Power Apps Split date and time with Concat function]

powerapps split date and time

Follow the steps below to achieve this!

Here, I have a SharePoint list named “Public Holidays.” which stores all the holiday dates.

powerapps split dates

1. Add a button control in the Power Apps screen to create a collection that stores all the holiday dates from the SharePoint list.

split date in powerapps

2. Add a Data Table control and provide the below collect name in its Items property.

colHolidayDates
powerapps split and concat

3. To split the dates, add the formula below to the Text property of the column in the data table control.

Concat(Split(ThisItem.HolidayDate,"/"),Value," ")

Here, using space, the Concat function will concat the dates that are split by “/.”

powerapps split datetime by delimiter and concat

Example 7: [Power Apps split a string into rows and columns]

Look at the image below. In the text label, I have the addresses of some cities in the USA, which is in not an understandable format. After using the Power Apps split function, the addresses are split into rows and columns in the data table.

power apps split string into rows

Follow the steps below to achieve this!

1. In Power Apps, add a Text label and provide the address collection in its Text property.

 "47 W 13th St, New York, NY 10011, USA,20 Cooper Square, New York, NY 10003, USA,1 E 2nd St, New York, NY 10003, USA,75 3rd Ave, New York, NY 10003, USA,Metrotech Center, Brooklyn, NY 11201, USA,19 Washington Square N, New York, NY 10011, USA,70 Washington Square South, New York, NY 10012, United States,100 Bleecker St, New York, NY 10013, USA,Rubin Residence Hall, New York, NY 10003, USA"
powerapps split string into rows

2. Add a data table control and provide the below formula in its Items property.

With({items:Split(lbl_Address.Text,",")},         
     ForAll(Sequence(CountRows(items),1,4),
           {
              Address: Index(items,Value).Value,
              City: Index(items,Value +1).Value,
              ZipCode: Index(items,Value +2).Value,
              Country:Index(items,Value +3).Value
           }
     )
)
powerapps split string into columns

3. Add the columns to the data table by opening the Properties pane. There, click on Edit fields next to Fields -> Click on + Add field -> Check all the Column names -> Click on Add button.

powerapps split string into columns and rows at the same time

4. Look at the image below; the addresses in the text label are split into rows and columns in the Power Apps data table control.

powerapps split string into columns and rows

This way, we can use the Power Apps split function to split the string with the provided separator.

I hope you understand how to use the Power Apps split function. In this article, I have provided seven different examples related to its usage. Follow this article if you are new to Power Apps functions.

Also, you may like:

>