Do you know how to format a number in a Power Automate flow? In this tutorial, I will show you how to use the **Power Automate formatNumber() function** in a flow with a few examples of Power Automate format number expressions on standard formats.

**Power Automate formatNumber() function is used to display numbers in various formats of context like Currency, Serial Numbers, Float, Percentage, Exponential format, etc. Example: Currency – formatNumber(trigger outputs()?[‘body/CoursePrice’],’C0′) or Percentage -formatNumber(trigger body()[‘number’],’P1′).**

Overall, I will explain the examples below:

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

## Power Automate formatNumber() Function

Power Automate formatNumber() is one of the string functions. This function is useful to convert the number into a required format. The provided number is converted based on the applied format.

It returns the output as a formatted number as a string based on the specific format.

**Syntax:** formatNumber(number, 'format', 'locale')

**Example:** formatNumber([7895], ‘C0’) => Returns the output in the form of $7895.

## FormatNumber() Function Examples in Power Automate

Here, I will discuss some of the Power Automate format number expressions on standard formats.

Below, you can find examples and explanations of each standard format.

### Power Automate format number as currency

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

‘C2’ represents the default format concerning ‘C’.

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 -> select â€˜Instant cloud flowâ€™. Give Flow name, and select trigger **â€˜**Manually trigger a flow**â€™** -> Click 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.

### Power Automate format number to leading zeros

In scenarios like providing the required number of digits to achieve a particular length, a user can add leading zeros frequently to that number.

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 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 as below.

### Power Automate float decimal places expression

To add decimal places for a number, you can 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 it. 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 below image shows the output of decimal places from the formatted number.

### Power Automate format number thousand separator

A user can format a number separated with commas along with configuring the number of decimal places in it, he/she can use the formatNumber() expression with the standard ‘N’ expression.

Where the ‘N’ format is similar to the ‘F’ format. In the same way, ‘N’ is followed by the 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.

### Power Automate format number to percentage

To get a percentage automatically for a number, In Power Automate formatNumber() will be helpful to format the number into percentage format by using standard ‘P’ format.

Where, the percentage will be multiplied by 100, and the output in the form of a string along with the percentage.

In the expression, ‘P’ followed by the digit refers 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% |

Go through the expression provided 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.

### Power Automate format number to Hexadecimal

The hexadecimal format is the number system where it has a base value of ’16’, which includes numbers from (0-9) and digits from (A-F). Example: Â 7B316, 6F16.

In Power Automate, this format can be achieved by 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.

### Power Automate Fixed Point decimal places

In the Fixed-Point decimal places, the formatted number will be displayed with decimal, which we fixed in the formatNumber() expression, even if the provided number has several decimal places. If the provided number is a whole number, then it will add a fixed number of decimal places to that number.

This can be done by 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.

### Power Automate format number as Exponent

For converting a number into an exponent form, Power Automate has a formatNumber() function that uses the standard ‘E’ format to convert the numbers.

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 is how to use the Power Automate format number expression on standard formats.

## Conclusion

Formatting a number will be useful when dealing with Power Automate flows to change the various contexts. The Power Automate Format Number flow action and formatNumber() function can be used to simplify the numbers into specific formats. I hope this tutorial will guide you in understanding the **Power Automate formatNumber() function** in standard formats.

You may also like:

- Power Automate isInt() Function
- Power Automate endsWith() 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.