Power Automate Number Format

In this Microsoft Power Automate Tutorial, we will see various examples of Power Automate Number Format. We will learn how to format a number to different data types such as:

  • Power Automate check if it is number or not
  • Power Automate convert number to currency
  • Power Automate convert number to hexa decimal
  • Power Automate format number percentage
  • Power Automate convert a number to rounding UP or Down
  • Power Automate convert value to string
  • Power Automate convert number to date
  • Power Automate convert integer to array

Power Automate check if it is number or not

In Power Automate, there is no direct function or expression to check whether the input is a number or not. So we will resolve this issue by following these steps.

Step-1:

First, we will trigger a flow manually. For this, go to Power Automate > Click on Create > Select Instant cloud flow.

Power automate is number
Power automate is number

After clicking on that, it will create a flow like below:

Power automate is number or not
Power automate is number or not

Step-2:

Now we will initialize a variable. Then set the type as “boolean” and value as “True“.

Power automate is number or not
Power automate is number or not

(For our better reference, we just renamed the action name)

Step-3:

Now we will initialize another variable and set the type as “String” and give a value like below:

Check if it is a number or not in Power Automate
Check if it is a number or not in Power Automate

Step-4:

Then we will add a Compose action that will convert the above string variable into an integer. For this expression is:

int(variables('VarNumber'))
Power automate check if it is a number or not
Power automate check if it is a number or not

Step-5:

In the next step, we will set our previous variable “VarIsInteger” as false because if the Compose action fails.

Microsoft flow check if it is a number or not
Microsoft flow check if it is a number or not

In this step, also we have to set the “Configure run after – has failed” to true and click on Done like below.

Check if it is a number or not in Power Automate flow
Check if it is a number or not in the Power Automate flow
Check if it is a number or not in the Power Automate flow
Check if it is a number or not in the Power Automate flow

Step-6:

Then finally we will put a condition that will check whether the variable “VarIsInteger” is true or not.

  Check if it is a number or not in the Microsoft flow
Check if it is a number or not in the Microsoft flow

Here also, we have to set “configure run after” as succeed and skipped. It is a very important step because if we don’t want to always fail our flow then we have to configure it.

Check if it is a number or not in Microsoft flow
Check if it is a number or not in Microsoft flow

Read Power Automate Initialize Variable

Testing for Non-numeric data type or not

Now we just save the flow and test it as a Manual test. We can see it will return false as our input “123abc” in “VarNumber” is not a number.

Power automate flow if it is number or not
Power automate flow if it is number or not

Read Power Automate convert time zone

Testing for Numeric data type or not

Now, we will check whether the input is a number or not. For this, we will do a modification on value from “123abc” to “123“. Then save the flow and test it again.

We can see it will return true as the input is an integer or number.

Check if it is a number or not in Microsoft flow
Check if it is a number or not in Microsoft flow

This is how we can check whether the input is a number or not in Microsoft Power Automate flow. You can download this flow from here.

Read Power Automate Concatenate String

Power Automate convert number to currency

Recently, we have worked on a SharePoint list where we have to insert the project’s Title(Single line text) and its cost(Currency type).

Here is our SharePoint list:

convert number to currency in Power Automate
convert number to currency in Power Automate

When a user inserts that details in SharePoint List it will notify the CEO or another user. For this, we have created an automated flow and fetched this list on that flow.

convert number to currency Power Automate flow
convert number to currency Power Automate flow

When the CEO or another user got that notification through mail, the cost is came as a number instead of currency like below:

convert number to currency Microsoft flow
convert number to currency Microsoft flow

But it is the right way to show the cost in a number instead of currency. To solve this issue, let’s have a look at the below solution with step-by-step guides.

Step-1:

We will add a “Compose” action just after the “When item is created” action. Here we will use “cost” as input from dynamic content.

Microsoft flow convert number to currency
Microsoft flow convert number to currency

Step-2:

After Compose, we will add another action “Format number” that will format the number into currency.

Microsoft flow convert number into currency
Microsoft flow convert number into currency

In Format number, we have used the output of composing as a number. Also, we have chosen a number format as $1,234.00 and Locale as en-US.

Step-3:

Now we will use this Formatted number as cost in the “Send an email” action.

Power Automate flow convert number into currency
Power Automate flow convert number into currency

Now our flow is ready to run. So first, we have to Save it and test the flow. This time when we will insert any value in SharePoint ist, we can see the cost will come in a currency format in our mailbox.

Convert a number in currency Power Automate flow
Convert a number in currency Power Automate flow

This is how we can Convert a number in currency format Power Automate flow. Similarly, we can format the number in any currency format such as ¥(yuan), €(Euro), ₹(rupee), etc. from Locale(in Format number).

Read Leave Request Approval Flow using Power Automate or Microsoft Flow

Power Automate convert number to hexa decimal

Here we are going to discuss how to implement this by following these easy steps.

Step-1:

In Power Automate, first, we have to trigger a flow automatically. For this, on Power Automate, go to create flow, then click on “Instant cloud flow” and select “Manually trigger flow“.

Convert a number in Hexadecimal in Power Automate
Convert a number in Hexadecimal in Power Automate

It will create a blank flow that will trigger the flow manually.

Step-2:

Now we will add an action “Format Number” that will format a number into hexadecimal. In that action, we will set a value that we can want to format. Also, set format type for hexadecimal as “X0” or “x0“.

Power Automate convert number to hexadecimal
Power Automate convert number to hexadecimal

Now just Save the flow and Run it. We can see the output is coming as hexadecimal like below:

Convert number to hexadecimal Power Automate
Convert number to hexadecimal Power Automate

As we put format type as “X0“, so the output came with a Capital letter. If we put format type as “x0” then the output will come in a small letter.

Convert number to hexadecimal Power Automate
Convert number to hexadecimal Power Automate

This is how we can convert any number into a hexadecimal format in Power Automate flow. You can download this flow from here.

Also read, How to convert decimal to whole number in Power Automate

Power Automate format number percentage

By following these steps we can convert a number into a percentage.

Step-1:

Before formatting, we need to manually trigger our flow. For this, we have to select “Manually trigger flow” from “Instant cloud flow” then click on Create.

Power Automate format number percentage
Power Automate format number percentage

Step-2:

After adding “Manually trigger flow“, now we will add another action “Format number” on that flow. That will convert any number to a percentage in Power Automate.

 Format number to percentage on Power Automate
Format number to percentage on Power Automate

For example, we have set a number(i.e.1) that we want to format. Also, we have used “P0” as the format type. In “P0“, P stands for Percentage, and 0 stands for decimal value. When we run the flow, we can see the output will come as “100%“.

format number to percentage on Microsoft Flow
format number to percentage on Microsoft Flow

Similarly, if we use “P2“, then the output will come with two decimal values. For example:

Power Automate convert a value to percentage
Power Automate convert a value to a percentage

This is how we can convert a value to a percentage in Power Automate. You can download this automated flow from here.

Check out, What is Power Platform

Power Automate convert a number to rounding UP or Down

Now we will discuss how to convert a number to rounding up or down in Power Automate or Microsoft flow.

For this, here we have provided a simple guide with 2 different methods. By following these we can easily convert a number to round up or down on Power Automate flow.

Method-1: by assigning a variable

For example, we have a number like 45.863; but we want to format this number to round up i.e. 46. To implement this, follow these steps:

Step-1:

On Power Automate, first, we will add “manually triggered a flow” that will trigger the flow manually as needed from Instant cloud flow. Then click on Create.

convert a number to rounding UP or Down Power automate
convert a number to rounding UP or Down Power automate

Step-2:

Under that trigger, we will add an action to initialize a variable i.e. Initialize variable. Here we will set a variable name, its type(it should be a string type), and a value(a dynamic value) like below.

Power Automate convert a number to Rounding up or down
Power Automate convert a number to Rounding up or down

Step-3:

Then we will add a Compose action. On that Compose action, we will use an expression that will convert the above string(number) into the round-up on Power Automate.

The expression is:

add(int(first(split(variables('MyVar'),'.'))),1)
convert a number to rounding UP or Down Microsoft flow
convert a number to rounding UP or Down Microsoft flow

Now our flow is ready to run. Also, we can see the out is coming as a round number like below:

convert a number to rounding UP or Down on Power automate
convert a number to rounding UP or Down on Power automate

This is how we can convert a number to rounding up or down on Power Automate.

Read How to move files from OneDrive to SharePoint using Power Automate

Method-2: using Formt number

There is another action “Format number” on Power Automate, by which we can format the number to rounding up.

For example, we have a number like 45.869. Now, we will see how to convert this number to rounding up or down on Power automate using Format number action.

On that, we will set a random number that we want to format. Also, on the format type, we will set “N2” which will format the number to round up with 2 decimal places.

Microsoft flow convert number into rounding up or down
Microsoft flow convert number into rounding up or down

Let’s save the flow and test & run it to see the output. We can see the output is coming from 45.869 to 45.87.

Power Automate convert a number into Rounding up or down
Power Automate convert a number into Rounding up or down

Similarly, if you insert N1 instead of N2, it will return the output as

In these above ways, we can convert a number into Rounding up or down on Power Automate. You can download the whole flow from here.

Read Scheduled cloud flow Example

Power Automate convert value to string

In this Power Automate Tutorial, we will discuss how to convert a value to a string in an automated flow or Microsoft flow.

There are various methods by which we can format a number or value to a string in Power Automate. We will describe these methods with step by step guide.

Method-1: Using String() function

In this method, we will see how to convert a number to a string using the string() function in Power Automate.

Step-1:

In Power Automate, we will add “Manually trigger a flow” from “instant cloud flow“.

Step-2:

After adding this trigger in our flow, we will add a compose action. In that action, we will use any static value as an input. For example, here we will use a random number i.e. 123

Power Automate convert value to string
Power Automate convert value to a string

Step-3:

Again, we will add another Compose action that will format the output of the compose(i.e. 54321) into a string by using an expression. Insert the below expression in the expression bar and click on Update.

string(outputs('Compose'))
Convert value to string Power Automate
Convert value to string Power Automate

Now the flow is ready. So we need to just Save and test it. We can see the output is coming as “string“.

Convert number to string Power Automate
Convert number to string Power Automate

Note: In Power Automate, a numeric value comes as a “Green color” and a string value coming as “Black color“. Let’s have an example to check this.

For example, we will add another Compose action to convert the output of the compose(i.e compose-1) into an integer. And the expression is:

int(outputs('Compose'))
Convert a value to a string in Power Automate
Convert a value to a string in Power Automate

Similarly, when we save and test this flow we can see the output is coming as an integer(i.e. in Green color).

Convert a number to a string in Microsoft flow
Convert a number to a string in Microsoft flow

This is how we can convert a number to a string using the string() function in Power Automate Flow.

Also read, Power Automate Delete all items in SharePoint list

Method-2: Using Format number action

In this method, we will use convert a number into a string using “Format number” in Power Automate flow.

To implement this, we will add an action “Format number” after the “Compose“. In that action, we will use the output of composing (i.e. 54321) as a Number or you can insert any random number directly. And, in Format, we will set 0000 as the numeric format string.

format number to String on Microsoft Flow
format number to String on Microsoft Flow

Now the flow is ready to Run. We can see the output(i.e. 54321) is coming as String.

format number to String on Power Automate
format number to String on Power Automate

This is another format number to String on Microsoft Flow.

Also read, PowerApps upload file to SharePoint document library

Power Automate convert number to date

Now we will see how to convert a number to date format on Power Automate. For example, if we insert a number 310(you can insert a number dynamically), then it will be converted into a date format. Follow these steps to implement this:

Step-1:

On Power Automate, first, we will start the flow by triggering it manually. On that trigger, we will use the number data type as an input.

Power Automate convert number to date
Power Automate convert number to date

Step-2:

Then we will add a Compose action to formatting the date-time. For this, we are going to use an expression:

formatDateTime('1-1-2021','dd-MMM-yyyy')

Here, we used the ‘1-1-2021’ as our starting date.

Power Automate convert number to date
Power Automate convert number to date

Step-3:

Then, we are going to use an expression under another Compose action. To get the current date we need to add the number of days to the starting date.

addDays(outputs('Starting_date_format'),sub(triggerBody()['number'],1))

Here, we used 1 because if we only add the number, it will return tomorrow’s date not today’s date. To get today’s date we used 1 as the reference date is start from 1 not 0.

convert number to date Power Automate
convert number to date Power Automate

Step-4:

Now we will convert this output to timezone. For this, we will use the action “Convert timezone“. Let’s say we want to convert the timezone to Eastern standard time.

Microsoft Flow convert number to date
Microsoft Flow convert number to date

Now the flow is ready to run. When we will test it, it will ask to insert a number. Then it will calculate the date by adding that number of days to the starting date or reference date.

Let’s say we will insert a number i.e. 315. The output will come as:

How to convert a number to date on Microsoft flow
How to convert a number to date on Microsoft flow

As the starting date is January 1, 2021, so It is showing the Date that was added to 315 days of the starting date i.e. November 11, 2021.

This is how to convert a number to date on Microsoft flow.

Also read, Save my email attachments to a SharePoint document library Power Automate or Flow

Power Automate convert integer to Array

Now we will see how to convert an integer into an Array on Power Automate. For this, Microsoft flow provides an ‘array()‘ function.

For example, first, we will initialize a variable as integer value.

power automate convert integer to array
power automate convert integer to array

Then we will insert an expression under Compose action, that will convert the integer value into an array using the array().

array(variables('varInt'))
convert integer to array Power Automate
convert integer to array Power Automate

When we test the flow, we can see the output is coming as an array data type:

How to convert integer to array on power automate
How to convert integer to array on power automate

This is how to convert integer to array on power automate.

There is another function “createArray()” to create an array by using object. Here we can create an array using multi-integers.

For this, we are going to add another compose action using createArray expression.

createArray(78, 55, 66, variables('varInt'))
convert integer to array Microsoft flow
convert integer to array Microsoft flow

Now we can see there is an array created on the output:

How to convert integer to array on Microsoft flow
How to convert integer to array on Microsoft flow

This is how to convert multi-integer to array on Microsoft flow.

You may also like the following Power Automate tutorials:

Conclusion

From this Power Automate Tutorial, we learned all about number format on Power Automate. Also, we discussed:

  • How to Power automate is number or not?
  • How to convert number to currency on Power Automate?
  • How to convert number to hexa decimal on Microsoft Flow?
  • How to format number to percentage on Microsoft Flow?
  • How to convert a number to rounding UP or Down on Power Automate?
  • How to convert a value to string on Power Automate?
  • How to convert number to date on Power Automate?
  • How to convert number to time on Microsoft flow?
>