In this Power Automate tutorial, I will explain how to **format number in Power Automate**.

Microsoft provides a function in Power Automate called **formatNumber()** that you can use to format a number in Power Automate. Also, you can use the Format Number action in Power Automate.

I will also show you a few examples related to format number in Power Automate:

- How to format number as currency in Power Automate
- How to format number to leading zeros in Power Automate
- Working with Power Automate float decimal places expression
- Power Automate format number Hexa decimal expression
- Power Automate format number thousand separator
- Format number to percentage in Power Automate
- Power Automate Fixed Point decimal places
- Power Automate format number expression as exponential format

## Power Automate formatNumber() Function

**formatnumber()** Power Automate is a function that takes a number and formats it into the desired format, which can be a float, currency, percentage or another type of data.

Below is the syntax for the Power Automate format number:

`formatNumber(number, 'format', 'locale')`

Where,

**Number**: Provide the number that you want to format**â€˜formatâ€™**: The number will get formatted**Locale**: Provide the locale while formatting the number to any different data type [Optional]

**Example:**

`formatNumber([7895], 'C0') // Output - $7895`

## How to Use Power Automate formatnumber Function

Let’s discuss some of the useful examples using Power Automate format number expression:

### Format Number as Currency in Power Automate

Here, I will explain how to work with Power Automate format number as currency.

To define the standard currency format, Power Automate format the number as currency with commas, i.e., **‘C’** format. To get the decimal places after the number, use ‘C’ followed by numbers.

‘C2’ represents the default format concerning ‘C’. Refer to the table below:

Number | Format | Expression | Result |

56789 | C | formatNumber(56789,â€™Câ€™) | $56,789.00 |

56789 | C0 | formatNumber(56789,â€™C0â€²) | $56,789 |

56789 | C1 | formatNumber(56789,â€™C1â€²) | $56,789.0 |

56789 | C2 | formatNumber(56789,â€™C2â€²) | $56,789.00 |

56789 | C3 | formatNumber(56789,â€™C3â€²) | $56,789.000 |

Follow the below steps:

**1.** Open the Power Automate Home page, click on **+ Create** -> **Instant cloud flow**. Give Flow name, and select trigger **Manually trigger a flow** -> **Create**.

- In the trigger, Click Add an input -> Select Number.

**2.** Now, add an ‘Initialize variable’ flow action and set properties like **Name**, **Type**, and **Value**.

**Value: **formatNumber(triggerBody()['number'],'C0')

**3.** In this step, add ‘Compose’ data operation to check the output received from the given expression.

**4.** Now, it is time to save and test the flow. Click on **Save **and **Test **-> Test Manually.

**5.** The outputs of the compose data operation will return the formatted number as currency, as shown below:

This is how to get the formatted number as currency with commas inside a Power Automate flow.

### Format Number With Leading Zeros in Power Automate

Next, we will see how to work with Power Putomate add leading zeros.

In Power Automate, this can be done by providing a standard ‘**D**‘ format in formatNumber expression. In the expression, ‘D’ followed by the digit refers to the total number of digits consisting of a provided number.

The below-placed table below will show different formats of digit expression:

Number | Format | Expression | Result |

567 | D | formatNumber(567,â€™Dâ€™) | 567 |

567 | D3 | formatNumber(567,â€™D0â€²) | 567 |

567 | D4 | formatNumber(567,â€™D1â€²) | 0567 |

567 | D5 | formatNumber(567,â€™D2â€²) | 00567 |

567 | D6 | formatNumber(567,â€™D3â€²) | 000567 |

For that, follow the above-mentioned but only need to change the expression of formatNumber.

**1.** In the ‘Initialize variable’ flow action, provide details like Name, Type, and Value to convert the string to an integer.

`int(triggerBody()['number'])`

**2.** In the Inputs of compose flow action, add the below-given expression to add the leading zeros.

`formatNumber(variables('Digit'),'D3')`

**3.** The output displayed from the compose data operation will show the result below.

This way, we can achieve Power Automate format number leading zeros.

### How to Use Power Automate Float Decimal Places

To add decimal places for a number, use the format() number function using the standard ‘**F**‘ format inside a Power Automate flow.

In the expression, ‘F’ followed by the digit refers to the total number of decimals provided. In the formats, ‘F2’ is the default format that resembles the ‘F’ format.

Number | Format | Expression | Result |

56789 | F | formatNumber(56789,â€™Fâ€™) | 56789.00 |

56789 | F0 | formatNumber(56789,â€™F0â€²) | 56789 |

56789 | F1 | formatNumber(56789,â€™F1â€²) | 56789.0 |

56789 | F2 | formatNumber(56789,â€™F2â€²) | 56789.00 |

56789 | F3 | formatNumber(56789,â€™F3â€²) | 56789.000 |

Follow the below-mentioned points:

**1.** Provide the formatNumber expression in the value section of the initialized variable.

**Value:** formatNumber(triggerBody()['number'],'F2')

**2.** The image below shows the decimal places output from the formatted number.

### Power Automate Format Number Thousand Separator

A user can format a number separated by commas and configure the number of decimal places using the formatNumber() expression with the standard ‘**N**‘ format.

The ‘N’ format is similar to the ‘F’ format. In the same way, ‘N’ is followed by a digit, which refers to the total number of decimals provided in it.

Number | Format | Expression | Result |

56789 | N | formatNumber(56789,â€™Nâ€™) | 56,789.00 |

56789 | N0 | formatNumber(56789,â€™N0â€²) | 56,789 |

56789 | N1 | formatNumber(56789,â€™N1â€²) | 56,789.0 |

56789 | N2 | formatNumber(56789,â€™N2â€²) | 56,789.00 |

56789 | N3 | formatNumber(56789,â€™N3â€²) | 56,789.000 |

**1.** Give the expression for a thousand separator with commas in the value of an initialized variable.

`formatNumber(triggerBody()['number'],'N1')`

**2.** The returns of the formatted number expression will give the number with commas as shown below.

### How to Format Number to Percentage in Power Automate

We can use the standard ‘**P**‘ format with the Power Automate format number as a percentage.

Using this, the percentage will be multiplied by 100, and the output will be a string along with the percentage.

In the expression, ‘P’ followed by a digit refers to the number of decimals displayed that should be included in the format.

Number | Format | Expression | Result |

0.10 | P | formatNumber(0.10,â€™Nâ€™) | 10.00% |

0.10 | P0 | formatNumber(0.10,â€™N0â€²) | 10% |

0.10 | P1 | formatNumber(0.10,â€™N1â€²) | 10.0% |

0.10 | P2 | formatNumber(0.10,â€™N2â€²) | 10.00% |

0.10 | P3 | formatNumber(0.10â€™N3â€²) | 10.000% |

Follow the example below:

**1.** Add the below-placed percentage expression in the ‘Value’ parameter of an initialized variable.

`formatNumber(triggerBody()['number'],'P1')`

**2.** The returns of the formatNumber expression will be displayed in the outputs of compose.

This way, we can format numbers into percentages in Power Automate.

### How to Format Number to Hexadecimal in Power Automate

The hexadecimal format is the number system with a base value of ‘**16**‘, which includes numbers from (**0-9**) and digits from (**A-F**).

Examples: **7B316**, **6F16**.

In Power Automate, this format can be achieved using the formatNumber() expression with the standard format of ‘**X**‘. This format only works for the whole numbers.

Follow the below instructions:

**1.** In the ‘Initialize variable’ change the expression of formatNumber to hexadecimal format. Use the below expression placed in the code.

`formatNumber(triggerBody()['number'],'X')`

**2.** The hexadecimal format of the provided number will be displayed in the below screenshot.

This way, we can format a number to hexadecimal in Power Automate.

### Power Automate Fixed Point Decimal Places

Regardless of how many decimal places the provided number has, the formatted number will be presented in the Fixed-Point decimal places corresponding to the decimal we fixed in the formatNumber() expression.

If the provided number is a whole number, it will be added to that number by a fixed number of decimal places.

This can be done using the standard ‘**F**‘ format in the formatNumber() expression. The precision specifier will define the number of decimal places that should be displayed.

Number | Format | Expression | Result |

56789 | F | formatNumber(56789,â€™Fâ€™) | 56789.00 |

56789 | F0 | formatNumber(56789,â€™F0â€²) | 56789 |

56789 | F1 | formatNumber(56789,â€™F1â€²) | 56789.0 |

56789 | F2 | formatNumber(56789,â€™F2â€²) | 56789.00 |

89.145263 | F3 | formatNumber(56789,â€™F3â€²) | 89.145 |

**1.** Add the ‘Initialize variable’ flow action and set the below details.

**Name:**Enter a name for a variable.**Type:**Select a datatype from the drop-down.**Value:**Add the value as given in the code below.

`formatNumber(triggerBody()['number'],'F3')`

**2.** The compose flow action outputs will give the return value from the formatted number expression.

### How to Format Number as Exponent in Power Automate

Power Automate has a formatNumber() function that converts numbers into exponent form using the standard ‘**E**‘ format.

The exponential format is in the form of (**E+n**). There is always a dot after one digit. In the expression, ‘E’ followed by the number will define how many digits should be displayed after the dot. By default, it will take six digits after the dot.

Number | Format | Expression | Result |

596 | E | formatNumber(596,â€™Eâ€™) | 5.960000E+002 |

596 | E1 | formatNumber(596,â€™E1â€™) | 6.0E+002 |

596 | E2 | formatNumber(596,â€™E2â€™) | 5.96E+002 |

596 | E3 | formatNumber(596,â€™E3â€™) | 5.960E+002 |

**1.** Add the value of the initializing variable with the formatNumber expression that will convert the number into an exponential format.

**Value:** formatNumber(triggerBody()['number'],'E')

**2.** The outputs of the compose data operation will display the formatted number in exponential format, as shown below.

This way, we can format a number as an exponent in Power Automate.

## Conclusion

I hope this article gave you an overall idea of how to work with format numbers in Power Automate. There are various examples, such as format number as currency in Power Automate, format number to leading zeros in Power Automate, and many more.

Some more articles you may also like:

- Power Automate isInt() Function
- Power Automate substring() Function
- Power Automate toUpper() Function

Preeti Sahu is an expert in Power Apps and has more than 6 years of experience working with SharePoint and the Power Platform. As a Power Platform expert for Power BI, Power Apps, Power Automate, Power Virtual Agents, and Power Pages, she is currently employed with TSinfo Technologies. She is the author of the book **Microsoft Power Platform A Deep Dive.**Â She also made a big technical contribution to SharePointDotNet.com in the form of articles on the Power Platform. She enjoys traveling and spending time with her family in her spare time.