How to Convert Float to Integer in Power Automate?

There will be times when you are required to convert a float to integer in Power Automate. In this Power Automate tutorial, we will see how to convert float to integer in Power Automate. So, here we will cover the below topics:

  • Convert float to an integer using the Format Number action in Power Automate
  • Convert float to an integer using formatNumber() in Power Automate
  • Dynamically converts a float to an integer in Power Automate

Convert float to an integer using Format Number action in Power Automate

Here, we will see how to convert float to an integer using the Format Number action in Power Automate flow.

We will create an Instant cloud flow, initialize a float variable, and convert float to an integer using Format number action.

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

power automate convert float to integer

2. Provide the flow name and select Manually trigger a flow. Then click on Create.

Power Automate float to int

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

convert float to int in microsoft power automate

3. Next, we will initialize a float variable, for this, click on the +New step -> select the Initialize variable action and then provide the below information

  • Name: Provide the variable name
  • Type: Select the type as float
  • Value: Provide the float number like the below image.
power automate convert float to integer

4. Now we will convert the float number to integer, so click on the +New step -> select Format number action, and then provide the below information

  • Number: Select the variable from the dynamic content
  • Format Provide the format as ‘#’ or ‘N0’
How to convert float to int in power automate

5. Now run the flow manually, and you can see the output of the format number action, float converted to integer in Power Automate.

How to convert float to integer in power automate

This is how to convert float to integer using Power Automate.

Convert float to an integer using formatNumber() in Power Automate

Here, we will see how to convert float to an integer using formatNumber() in Power Automate.

We will create an Instant cloud flow, initialize a float variable, and convert float to integer using formatNumber().

1. In Power Automate Cloud, click on the +Create icon and select Instant Cloud flow.

power automate convert dynamic content float to int

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

convert float to integer Microsoft power automate

You can see manually trigger a flow action is added to the flow page.

convert float to int in microsoft power automate

3. Next, we will initialize a float variable; for this, click on the +New step -> select the Initialize variable action. Then provide the information below

  • Name: Provide the variable name
  • Type: Select the type as float
  • Value: Provide the float number like the below image.
power automate convert float to integer

4. Now, we will convert the float to an integer in Power Automate; for this, click +New step, and select Compose action. Then, in the Inputs field, provide any of the expressions that will convert float to integer.

formatNumber(variables('FloatVal'), 'N0')
formatNumber(variables('FloatVal'), '#')
formatNumber(variables('FloatVal'), '###')
power automate convert float to int

5. Now run the flow manually, and the float is converted to an integer in Power Automate.

Power Automate float to int

This is how to convert float to int in Power Automate.

Dynamically converts a float to an integer in Power Automate

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

For example, a SharePoint list contains two columns: Title (Single line of text) and price (Number). Here, we need to convert the price to an integer value of Float type, using formatNumber().

Microsoft power automate convert dynamic content float to int

1. In Power Automate Cloud, click on the +Create icon and select Instant Cloud flow.

power automate convert dynamic content float to integer

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

convert float to integer Microsoft power automate

Now you can see Manually trigger a flow is added to the flow page

convert float to int in microsoft power automate

3. We will get items from the SharePoint list; for this, click on the +New step and select the ‘Get items‘ action. Then provide the below information:

  • Site address: Select the SharePoint site address
  • List name: Select the SharePoint list name
convert float to int in power automate

4. Next, click on the + New step and select Apply to each action that will loop through each item in the SharePoint list. Then provide the below information:

  • Select an output from previous steps: Select value from dynamic content.

Then click on Add an action, select Compose action, and provide the below information to convert the float number to an integer.

  • Inputs: Provide the below information:
formatNumber(items('Apply_to_each')?['Price'], '#')
convert float to integer in  Microsoft power automate

5. Next, we will update the price value as an integer; for this, click on Add an action and select Update item action. Then provide the below information:

  • Site address: provide the SharePoint site address
  • List name: Provide the list name
  • Id: Select the id from dynamic content
  • Title: Select the tile from dynamic content
  • Price: Select the output from dynamic content.
convert float to integer in power automate

6. Now, run the flow manually, and you can see the SharePoint list price column is updated with the integer value.

Microsoft power automate convert dynamic content float to integer

This is how to convert float to integer in power automate dynamically.

Conclusion

Converting a float to an integer in Power Automate is a very common requirement. In this tutorial, I have explained to you how to convert float to int in Power Automate using the Format Number action and the formatNumber() function in Power Automate.

You may also like:

>