How to take lastn / second, third, n word from phrase / sentence (string) in Power Automate

Hello,

In this short article I will provide clear instruction how to take for example second from the end word from sentence “I am Rafal Kobus” in Power Automate. Let’s say that we have our dynamic value in outputs(‘Compose’). Firstly we have to split phrase by spaces or other sign to have an array.

split(outputs('Compose'), ' ')

Then we are building as an example another Compose step where will have result.

first(skip(split(outputs('Compose'), ' '),sub(length(split(outputs('Compose'), ' ')),2)))

That function will give us Rafal from sample string. To adjust that to your requirements, parameter representing words from the end is the number at the end of function (here 2).

General look of the function:

first(skip(split(<your string>, <your delimiter>),sub(length(split(<your string>, <your delimiter>)),<selection parameter as number>)))


Leave a comment

About Me

As a power platform fan and developer of solutions that can help in daily tasks, I have a deep understanding of how technology can be leveraged to make everyday work more efficient and effective. With a passion for automation and optimization, I am always looking for new ways to streamline processes and save time. I have a strong knowledge of the power platform, including Power Apps, Power BI, and Power Automate, and I am skilled in creating custom solutions to solve specific business needs. My expertise and enthusiasm for the power platform make me an invaluable asset to any organization looking to enhance their productivity and streamline their workflows.

Newsletter

Design a site like this with WordPress.com
Get started