How to Convert String to Decimal in Power Automate?

Do you want to convert strings to decimal numbers in Power Automate? In this Power Automate tutorial, we will see how to convert a string to a decimal in Power Automate.

Converting a string into a decimal is a common task, especially when dealing with data from different places.

Sometimes, what seems like a decimal number is actually in the form of a text string. This can lead to problems later in your process if you want to work with these numbers. To avoid errors, you need to change these text strings into decimal numbers before doing any calculation with them.

We can change it using two functions i.e., decimal function and float function in Power Automate.

The decimal function and Float function take the value as a string and then convert it into a decimal number or float number.

decimal(<value>)
float(<value>)

Here, we will cover the examples below

  • How to convert string to decimal number in Power Automate.
  • How to convert string to decimal number dynamically using Power Automate

Convert string to decimal number in Power Automate

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

Example 1: Using float()

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

convert string to decimal power automate

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

convert string to decimal in power automate

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

convert string to decimal number power automate

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
How to convert string to decimal number Microsoft power automate

3. Now, we will convert the string to a decimal number; for this, click on the +New step -> select Compose action. Then provide the below information:

float(variables('str'))
How to convert string to decimal number power automate

4. Now save and run the flow manually, and you can see the converted string to a decimal number in Power Automate.

convert string to decimal number Microsoft power automate

Example 2: Using decimal()

See also  How to Send Email Reminders from a SharePoint List using Power Automate?

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

convert string to decimal power automate

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

convert string to decimal in power automate

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

convert string to decimal number power automate

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
How to convert string to decimal number Microsoft power automate

3. Now, we will convert the string to a decimal number; for this, click on the +New step -> select Compose action. Then provide the below information:

decimal(variables('str'))
 power automate convert string to decimal number

4. Now save the flow and run the flow manually, and you can see converted string to a decimal number in Power Automate.

convert string to decimal number Microsoft power automate

This is how to convert the string to a decimal number in Power Automate.

Convert string to decimal number dynamically using Power Automate

Here, we will see how to convert strings to decimal numbers dynamically using Power Automate.

For example, we have a SharePoint list called Product, which contains two columns i.e., Name and Price.

power automate convert string to decimal

We will convert the price string value to a decimal number. For this, follow the below steps:

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

convert string to decimal power automate

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

convert string to decimal in power automate

Now, you can see the Manually trigger a flow action is added to the flow page in Power Automate.

See also  Power Automate Desktop loop through Excel rows

2. We will get items from the SharePoint list; for this, click on the +New steps -> select Get items action. Then provide the below information:

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

3. Now, we will convert the string to a decimal number; for this, click on +New step -> select Compose action. Then, provide the information below.

  • Inputs: Provide the below expression. This will automatically add Apply to each action.
decimal(items('Apply_to_each')?['Price'])
Microsoft power automate convert string to decimal number

4. Now save the flow and run the flow manually, and you can see that convert the string to a decimal number.

Microsoft power automate string to decimal

This is how to convert strings to decimal numbers dynamically in Power Automate.

Conclusion

In this Power Automate tutorial, we will see how to convert a string to a decimal number in Power Automate using the decimal() and float() functions.

You may like the following tutorials:

>