Number.RoundUp Function in Power Query M

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

The Number.RoundUp function in Power Query rounds a number up, to a whole number or to the number of decimal places you choose. So 4.1 becomes 5, even though it’s much closer to 4.

It’s what you use when falling short isn’t an option, like billing, packing, or splitting a cost.

Note that “up” means toward the higher number, so a negative like -3.2 becomes -3. Excel’s ROUNDUP function goes away from zero instead and gives -4 (Example 7 shows both).

Follow along with the example file

Number.RoundUp Function Examples.xlsx

Download

Number.RoundUp Function Syntax

Number.RoundUp(number as nullable number, optional digits as nullable number) as nullable number
  • number – the number you want to round up. If it’s null, Number.RoundUp returns null.
  • digits (optional) – how many decimal places to round up to. Leave it out to round up to a whole number.

What it returns: The rounded-up number, or null if the number is null.

The Number.RoundUp function is part of the Power Query M language, so it works wherever Power Query does in Excel: Excel 365, 2024, 2021, 2019, and 2016 for Windows, and Excel for Microsoft 365 on Mac.

When to Use the Number.RoundUp Function

Use this function when you need to:

  • Bill time in whole hours or minutes, where any part counts as a full unit
  • Work out how many boxes, packs, or trips you need
  • Split a cost so the shares never add up to less than the total
  • Round budgets or bookings up to the next hundred or thousand
  • Round up to a step, like the next 0.5 kg or the next 5 units

Example 1: Round Up to a Whole Number

Let’s start with the simplest use. Suppose a repair job took 4.1 hours, and you bill every started hour as a full hour.

In Excel, go to Data > Get Data > From Other Sources > Blank Query. In the Power Query Editor that opens, type this formula in the formula bar:

= Number.RoundUp(4.1)

Result: 5

Number.RoundUp rounds 4.1 up to 5

Here, Number.RoundUp gets only the number, so it rounds up to a whole number. Anything above 4, even 4.0001, goes up to 5.

A number that’s already whole stays as it is, so Number.RoundUp(4) returns 4.

In the example file, Example 1 types its number right into the query, so it doesn’t have a sheet. You can open it from Data > Queries & Connections.

Example 2: Round Up to Two Decimal Places

Here’s a common one when you split a bill. Below is a table named SharedCosts with the total for each expense and the number of people sharing it, and I want a Per Person column rounded up to the cent.

SharedCosts table with the total for each expense and the number of people sharing it

In the code below, the Source line uses the Excel.CurrentWorkbook function to pull the SharedCosts table into Power Query by its name.

If you try this on your own data, format it as a table (Ctrl + T) and put your table’s name in place of “SharedCosts”.

Create a new blank query (as in Example 1), open the Advanced Editor (Home > Advanced Editor), and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="SharedCosts"]}[Content],
#"Added Per Person" = Table.AddColumn(Source,"Per Person",each Number.RoundUp([Total]/[People],2),type number)
in
#"Added Per Person"

Result: A new Per Person column (31.24, 178.58, 97.5, 32.17, and 18.75)

A new Per Person column with each share rounded up to the cent

Here, the Table.AddColumn function adds a Per Person column that divides the total by the number of people. Number.RoundUp then rounds that up to 2 decimal places.

For the team lunch, 187.40 / 6 is 31.2333, which rounds up to 31.24. If you rounded it to the nearest cent with the Number.Round function instead, everyone would pay 31.23, and six people would come up 2 cents short.

The farewell gift splits exactly (75 / 4 is 18.75), so it doesn’t change. Power Query hides trailing zeros, which is why 97.50 shows as 97.5.

Example 3: Work Out How Many Boxes You Need

This is probably the most practical use of rounding up. Below is a table named SupplyOrders with the units ordered for each product and how many fit in a box, and I want a Boxes Needed column.

SupplyOrders table with the units ordered and the units per box for each product

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="SupplyOrders"]}[Content],
#"Added Boxes Needed" = Table.AddColumn(Source,"Boxes Needed",each Number.RoundUp([Units Ordered]/[Units per Box]),type number)
in
#"Added Boxes Needed"

Result: A new Boxes Needed column (11, 24, 8, 14, and 10)

A new Boxes Needed column with each count rounded up to a whole box

Here, the formula divides the units ordered by the units per box and rounds the result up to a whole number.

250 notebooks at 24 per box is 10.42 boxes. You can’t ship 0.42 of a box, so you need 11.

The gel pens divide exactly (1200 / 50 is 24), so they stay at 24.

If you want the number of boxes you can fill completely instead (10 for the notebooks), use the Number.IntegerDivide function, which drops the leftover part.

Example 4: Round Up an Existing Column in Place

Sometimes you don’t want a new column, you just want to round up the one you have.

Below is a table named CallLog with the length of each support call in minutes, and I want the Minutes column itself rounded up, since every started minute is billed.

CallLog table with call lengths in minutes and one missing duration

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="CallLog"]}[Content],
#"Rounded Up" = Table.TransformColumns(Source,{{"Minutes",Number.RoundUp,type number}})
in
#"Rounded Up"

Result: The Minutes column now shows 4, 1, null, 12, and 8

The Minutes column rounded up in place, with the missing duration still null

Here, the Table.TransformColumns function runs Number.RoundUp on every value in the Minutes column and puts the result back in the same column.

Table.TransformColumns hands each Minutes value to the function as its only input. Number.RoundUp needs nothing else to round up to a whole number, so you can pass just its name.

To round up to decimals instead, write it as each Number.RoundUp(_,1). Here, _ stands for the current value in the column, and 1 is the number of decimal places.

Call C-1043 has no duration, so it comes into Power Query as null. Number.RoundUp returns null for a null, so the blank stays blank and you don’t get an error.

Important: Number.RoundUp can’t round a number stored as text. A text value like “3.2” gives the error We cannot convert the value “3.2” to type Number, so change the column to a number type first.

Follow along with the example file

Number.RoundUp Function Examples.xlsx

Download

Example 5: Round Up to the Nearest Hundred

You can also round up to the left of the decimal point. Below is a table named EventPlanning with the expected guests for each event, and I want a Seats to Book column rounded up to the next hundred.

EventPlanning table with the expected guests for each event

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="EventPlanning"]}[Content],
#"Added Seats to Book" = Table.AddColumn(Source,"Seats to Book",each Number.RoundUp([Expected Guests],-2),type number)
in
#"Added Seats to Book"

Result: A new Seats to Book column (1300, 500, 100, 600, and 2100)

A new Seats to Book column rounded up to the next hundred

Here, -2 as the second argument tells Number.RoundUp to round up two places to the left of the decimal point, which is the hundreds. So 1234 becomes 1300, and 96 becomes 100.

The charity gala already has exactly 600 guests, so it stays at 600. Use -1 to round up to the next ten and -3 for the next thousand, so Number.RoundUp(46281,-3) returns 47000.

Microsoft’s documentation doesn’t mention negative digits, but they work this way when you test them, the same as in Excel’s ROUNDUP function.

Example 6: Round Up to the Next 0.5

Number.RoundUp can also round up to a step, like 0.5 or 5. Below is a table named Parcels with the weight of each parcel, and a courier that bills in steps of 0.5 kg, and I want a Billable Weight (kg) column.

Parcels table with the weight of each parcel in kg

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="Parcels"]}[Content],
#"Added Billable Weight" = Table.AddColumn(Source,"Billable Weight (kg)",each Number.RoundUp([#"Weight (kg)"]/0.5)*0.5,type number)
in
#"Added Billable Weight"

Result: A new Billable Weight (kg) column (2.5, 1, 4.5, 1.5, and 8)

A new Billable Weight column rounded up to the next 0.5 kg

Here, the formula divides the weight by 0.5 to get the number of half-kilo steps, rounds that up to a whole number, and multiplies it back by 0.5. For P-201, 2.3 / 0.5 is 4.6 steps, which rounds up to 5 steps, or 2.5 kg.

The column name has a space and brackets, so it’s written as [#"Weight (kg)"] inside the formula.

To round up to a different step, swap 0.5 for that step in both places. For example, Number.RoundUp([Price]/5)*5 rounds a price up to the next multiple of 5, like the CEILING function in Excel.

Example 7: Rounding Up Negative Numbers

Here’s where Number.RoundUp differs from Excel. Below is a table named FundReturns with last month’s return for each fund, some of them negative, and I want two columns to compare: one rounded up with Number.RoundUp, and one rounded the way Excel’s ROUNDUP function does it.

FundReturns table with positive and negative monthly returns

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="FundReturns"]}[Content],
#"Added Rounded Up" = Table.AddColumn(Source,"Rounded Up",each Number.RoundUp([#"Return (%)"]),type number),
#"Added Away From Zero" = Table.AddColumn(#"Added Rounded Up","Away From Zero",each Number.RoundAwayFromZero([#"Return (%)"]),type number)
in
#"Added Away From Zero"

Result: A Rounded Up column (4, -3, 2, -1, and -2) and an Away From Zero column (4, -4, 2, -2, and -3)

Number.RoundUp rounds negatives toward zero, while Number.RoundAwayFromZero matches Excel's ROUNDUP

Here, Number.RoundUp always goes to the next higher number. For a negative number, the higher number is the one closer to zero, so -3.2 becomes -3, not -4.

Excel’s ROUNDUP function works differently. It rounds away from zero, so =ROUNDUP(-3.2,0) in Excel gives -4.

The second column uses the Number.RoundAwayFromZero function, which matches Excel’s ROUNDUP. For positive numbers, both columns are the same (3.2 becomes 4 either way).

Important: If your data has negative numbers and your Power Query results don’t match ROUNDUP in Excel, this is why. Use Number.RoundAwayFromZero when you want the Excel behavior.

Example 8: When Number.RoundUp Rounds Up One Too Many

This last one can look like a bug. Below is a table named Discounts with a discount rate for each product, and I want to show each rate as a whole percentage, rounded up, in a Discount % column.

Discounts table with a discount rate for each product

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="Discounts"]}[Content],
#"Added Discount %" = Table.AddColumn(Source,"Discount %",each Number.RoundUp([Discount Rate]*100),type number),
#"Added Fixed Discount %" = Table.AddColumn(#"Added Discount %","Fixed Discount %",each Number.RoundUp(Number.Round([Discount Rate]*100,10)),type number)
in
#"Added Fixed Discount %"

Result: A Discount % column (8, 15, 13, 29, and 4) and a Fixed Discount % column (7, 14, 13, 28, and 4)

Discount % rounds 0.07 x 100 up to 8, while the Fixed Discount % column gives 7

The Discount % column shows the problem. The yoga mat’s rate is 0.07, so 0.07 x 100 should be exactly 7, but Number.RoundUp gives 8.

That’s because computers store most decimals as tiny approximations. In Power Query, 0.07 * 100 comes out as 7.000000000000001, and since that’s a hair above 7, Number.RoundUp takes it up to 8.

The same thing happens to 0.14 and 0.28 here, while 0.125 and 0.034 come out fine.

Excel’s own ROUNDUP function cleans this up for you, so =ROUNDUP(0.07*100,0) gives 7 in a worksheet. That’s why the same calculation can give different answers in Excel and Power Query.

The fix is in the Fixed Discount % column. Number.Round([Discount Rate]*100,10) first rounds the value to 10 decimal places, which removes the tiny extra bit, and then Number.RoundUp works on a clean 7.

So whenever a calculation feeds Number.RoundUp, especially one that multiplies decimals, round it to 10 decimal places first if an exact result matters.

Other Excel Articles You May Also Like:

  • Number.RoundDown – Use Number.RoundDown in Power Query M to round numbers down.
  • Number.Mod – Use Number.Mod in Power Query M to get the remainder of a division.
  • Number.Abs – Use Number.Abs in Power Query M to get the absolute value of a number.
  • Number.ToText – Use Number.ToText in Power Query M to format numbers as text.
  • List.Sum – Use List.Sum in Power Query M to add up a list of numbers.
  • Duration.TotalDays – Use Duration.TotalDays in Power Query M to get the days in a duration.
  • List.Numbers – Use List.Numbers in Power Query M to create a list of numbers.
  • Number.From – Use Number.From in Power Query M to convert values to numbers.

All Power Query Functions

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.