Power Automate Convert String to Float

Do you want to convert string to float in Power Automate? In this Power Automate tutorial, we will see how to convert string to float in Power Automate.

Converting a string to a float in Power Automate means changing a piece of text that looks like a number into an actual number so that Power Automate can use it.

In Power Automate, sometimes what seems like a number is actually treated as text. This can lead to problems in workflow when we want to do calculations or other operations with these values in Power Automate.

To convert a string to float in Power Automate, we will use float(), which will take the value as a string and convert it into float in Power Automate.

Syntax

float(string, locale)

Here, we will see the topics below

  • How do you convert string to float in Power Automate?
  • How do you convert string to float dynamically in Power Automate?

Convert string to float in Power Automate

Here, we will see how to convert string to float in Power Automate.

For example, we have a string ‘234.56’, and we will convert it into float using float() in Power Automate. The result will be 234.56.

1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.

power automate convert string to float

Then, provide a flow name and select Manually trigger a flow action. Then click on Create.

convert string to float power automate

Now, you can see the “Manually trigger a flow” action is added to the flow page.

power automate convert string to float

2. We will initialize a string variable, for this click on +New step -> select Initialize variable action. Then provide the below information:

  • Name: Provide the name of the variable
  • Type: Provide the type as a string
  • Value: Provide the value like below
power automate string to float

3. We will convert the above string to a float; for this, click on +New step -> select Compose action and then provide the information below.

  • Inputs: Provide the below expression
float(variables('str'))
string to float power automate

4. Now save and run the flow manually. You can see the string is converted to float in Power Automate.

string to float power automate

This is how we can convert string to float in Power Automate.

Convert string to float dynamically in Power Automate

Here, we will see how to convert the string to float dynamically from SharePoint in Power Automate.

For example, I have a SharePoint list called Product, which contains two columns i.e., Product name and Price, both are of single line of text.

convert string to float in power automate

We will get the items from the SharePoint list, and we will convert the single line of text to float in Power Automate.

To do this in Power Automate, follow the below steps:

1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.

convert to string power automate

Then, provide a flow name and select Manually trigger a flow action. Then click on Create.

convert string to float power automate

Now, you can see the “Manually trigger a flow” action is added to the flow page.

power automate convert string to float

2. Now we will get items from the SharePoint list; for this, click on the +New step -> select Get items action. Provide the below information:

  • Site address: Provide the SharePoint site address
  • List name: Provide the list name
Microsoft power automate convert string to float

3. Next, we have multiple items in the Sharepoint list; for this, click on +New step -> select Apply to each action. Then provide the below information:

  • Select an output from previous steps: Select value from dynamic content.
power automate string to float

4. We will convert the string to float; for this, click on Add an action -> select Compose action. Then, provide the information below.

  • Inputs: Provide the below expression:
float(items('Apply_to_each')?['Price'])
convert string to float power automate

5. Now run the flow manually, and you can see the string is converted to float type in Power Automate.

convert string to float in power automate

This is how to convert string to float in Power Automate dynamically.

Conclusion

In this Power Automate tutorial, we saw how to convert a string to float in Power Automate. Also, we saw how to dynamically convert a string to float in Power Automate.

You may also like:

>