Formatting Numbers in Power Automate Flow

Isaac Stephens, 31 January 2020

Power Automate has just released the new Format Number action, which allows you to format a number from one of the out of the box options, or by your own custom number format. This can be useful, as you are able to display numbers in a formatted way while maintaining the base value behind it for greater accuracy in calculations.

image

There are three options to choose from using the “Format” dropdown and from my experience testing, the options are a little misleading. The first option is displayed as “1,234.00” which may imply that it will format it with commas. So the number in the above image would be “20,012,020.00”, however this is not how it works. The number is actually formatted as if it were using the format string “#.00”. This means the number it returns is actually; “20012020.00”.

The next option is “-1,234.00” and again this may not be as obvious with what it does. You would assume that the number would be formatted as a negative with commas like this; “-20,012,020.00”. However, this option is actually a N2 string format which means it is formatted with commas and will display the minus sign if needed. So the number above would just be “20,012,020.00”.

image

The third and final option is “$1,234.00” and this one actually does work as expected and displays the number as a currency amount, “$20,012,020.00”.

The “Locale” dropdown allows you to select which region this value is relevant to. This is important as for some countries periods are used instead of commas so numbers would be formatted “20.012.020,000”, or they do not use the dollar, so they need to have their respective currency symbols.

image

With the provided options aside, you can also enter your own custom formats into the Format section. For example; you could enter “(###) ### ####” or “#%” and you would get a numbers as formatted below respectively.

image

image

This even allows for converting to Hexadecimal by using the formatting value “X” as shown below:

image

So go and start formatting your numbers and if you need some tips on how to create your own custom formats check out these links below from Microsoft:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings