Skip to main content

How to Round a Number in Power Apps with Round, RoundDown and RoundUp

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Power Apps has three functions that round a number to the decimal places you choose. Round goes to the nearest value, RoundDown always goes down and RoundUp always goes up. 445 minutes is 7.4166… hours: Round(445 / 60, 2) makes it 7.42.

The example is the Overtime Timesheet app, which saves each shift's hours to a SharePoint column with two decimal places, and shows whole hours and minutes on screen.

Syntax​

Syntax
Round(Number, DecimalPlaces)
RoundDown(Number, DecimalPlaces)
RoundUp(Number, DecimalPlaces)

From Microsoft's Int, Round, RoundDown, RoundUp, and Trunc functions page:

  • Round rounds up if the next digit is 5 or higher, and otherwise down.
  • RoundDown always rounds down to the previous lower number, towards zero.
  • RoundUp always rounds up to the next higher number, away from zero.
  • DecimalPlaces is required: 2 for two decimal places, 0 for a whole number, and a negative number to round to tens, hundreds and so on.

Step 1: Round to Two Decimal Places​

I put each formula into a text control's Text for a moment, so Studio's preview strip shows the result:

Any text control → Text
Round(445 / 60, 2)

445 minutes is 7.42 hours:

The formula bar with Round(445 / 60, 2), the preview strip reading 7.42 with Data type number, and the text control on the Log overtime screen showing 7.42

Step 2: Round Down to Whole Hours​

Any text control → Text
RoundDown(450 / 60, 0)

450 minutes is 7.5 hours; RoundDown keeps the 7 whole hours:

The formula bar with RoundDown(450 / 60, 0), the preview strip reading 7 with Data type number, and the text control showing 7

Step 3: Round Up​

Any text control → Text
RoundUp(450 / 60, 0)

The same 7.5 rounded up is 8:

The formula bar with RoundUp(450 / 60, 0), the preview strip reading 8 with Data type number, and the text control showing 8

Which One to Use​

You wantUseExample
A number to store or total, such as hours to 2 decimal placesRoundRound(445 / 60, 2) is 7.42
The whole units, with the rest shown separatelyRoundDownRoundDown(450 / 60, 0) is 7, and the 30 minutes come from Mod
Never less than the real amount, such as blocks of time that are charged wholeRoundUpRoundUp(450 / 60, 0) is 8

How the Example Uses Them​

When it saves an entry, the app rounds the hours to the 2 decimal places of the SharePoint Hours column:

Part of btnSaveLO → OnSelect
Hours: Round((DateDiff(Starts, Ends, TimeUnit.Minutes) - numBreakLO.Value) / 60, 2),

On screen, it shows whole hours with RoundDown and the minutes left over with Mod: How to Convert Minutes to Hours and Minutes in Power Apps.

Common Mistakes​

MistakeWhat happensDo this instead
Round for the whole hours of 7 h 30 min7.5 rounds to 8 hoursRoundDown for the whole hours
Leaving out DecimalPlacesMicrosoft lists it as requiredRound(x, 0) for a whole number
Expecting rounding to add zeros210 / 60 shows as 3.5, not 3.50Text(x, "0.00") for two places

Troubleshooting​

SymptomLikely causeFix
Hours show 8 for 7 h 30 minRound or RoundUp on a whole-hours partRoundDown
A negative number rounds the "wrong" wayRoundDown goes towards zero, RoundUp away from itSee the table of examples on Microsoft's page

FAQ​

What about Int and Trunc?​

Both make a whole number. Trunc removes the decimal part, like RoundDown(x, 0); Int goes to the lower whole number, so it differs for negative numbers: Int(-4.3) is -5 and Trunc(-4.3) is -4, from Microsoft's page.

How do I show 7.5 as 7.50?​

Rounding doesn't add zeros; formatting does. Text(450 / 60, "0.00") shows 7.50, as the minutes to hours and minutes guide shows live.

Conclusion​

Round to store a number to a set number of places, RoundDown for whole units with the rest shown separately, and RoundUp when the result must never be less than the real amount. All three take the number of decimal places as their second argument.

Additional Resources​