The Number.IntegerDivide function in Power Query divides one number by another and gives you only the whole-number part of the answer. So 30 divided by 7 gives you 4, and the leftover bit is dropped.
It’s handy for things like full boxes, full hours, or grouping rows.
It does have two quirks. Negative numbers are cut toward zero (-7 divided by 2 gives -3, not -4), and dividing by a decimal like 0.1 can give an answer that’s one too small unless you tell Power Query to use exact decimal math.
This article shows the everyday uses first and then both quirks, with examples you can follow in the example file.
Follow along with the example file
Number.IntegerDivide Function Examples.xlsx
Number.IntegerDivide Function Syntax
Number.IntegerDivide(number1 as nullable number, number2 as nullable number, optional precision as nullable number) as nullable number
- number1 – the number you want to divide (the dividend).
- number2 – the number you want to divide by (the divisor).
- precision (optional) – how Power Query does the math. Leave it out for
Precision.Double, or usePrecision.Decimalwhen you divide by decimals like 0.1 (Examples 8 and 9).
What it returns: The whole-number part of number1 divided by number2. If either number is null, it returns null.
The Number.IntegerDivide 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.IntegerDivide Function
Use this function when you need to:
- Find how many full boxes, pallets, or packs you can fill
- Convert months to full years, or minutes to full hours
- Split a list of rows into groups of a fixed size
- Put numbers into bands, like age groups of 10 years
- Pull the year out of a number like 20260117
Example 1: Find the Number of Full Weeks in 30 Days
Let’s start with a simple one. Suppose a project runs for 30 days, and you want to know how many full weeks that is.
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.IntegerDivide(30,7)
Result: 4

Here, 30 divided by 7 is 4.2857. Number.IntegerDivide keeps only the whole-number part, so you get 4 full weeks.
In the example file, Examples 1, 7, and 8 type their numbers right into the query, so they don’t have a sheet. You can open them from Data > Queries & Connections.
Example 2: Find How Many Full Pallets You Can Ship
Here’s a common use. Below is a table named ShipmentPlan with the number of cases ordered for each product and how many cases fit on one pallet, and I want the number of full pallets in a new Full Pallets column.

In the code below, the Source line uses the Excel.CurrentWorkbook function to pull the ShipmentPlan 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 “ShipmentPlan”.
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="ShipmentPlan"]}[Content],
#"Added Full Pallets" = Table.AddColumn(Source,"Full Pallets",each Number.IntegerDivide([Cases Ordered],[Cases per Pallet]),Int64.Type)
in
#"Added Full Pallets"
Result: A new Full Pallets column (3, 4, 4, 2, and 0)

Here, the Table.AddColumn function adds a Full Pallets column, and Number.IntegerDivide divides the cases ordered by the cases per pallet for each row.
The last argument, Int64.Type, sets the new column’s data type to whole number. You’ll see it in the later examples too, and it changes to type text when the new column holds text.
For Printer Paper, 130 cases at 40 per pallet is 3.25 pallets, so you get 3 full pallets. Dish Soap has 47 cases and needs 50 for a pallet, so it gets 0.
The leftover cases (10 for Printer Paper) are dropped. If you need them too, the Number.Mod function gives you the remainder of the same division.
Important: If a divisor is 0, Number.IntegerDivide doesn’t give an error. It returns NaN (not a number), which is easy to miss, so check for 0 first: each if [Cases per Pallet]=0 then null else Number.IntegerDivide([Cases Ordered],[Cases per Pallet]).
Example 3: Convert Age in Months to Full Years
This next one comes up a lot with age or tenure data. Below is a table named PetPatients from a vet clinic with each pet’s age in months, and I want the age in full years in a new Age (Years) column.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="PetPatients"]}[Content],
#"Added Age (Years)" = Table.AddColumn(Source,"Age (Years)",each Number.IntegerDivide([#"Age (Months)"],12),Int64.Type)
in
#"Added Age (Years)"
Result: A new Age (Years) column (3, 0, null, 10, and 4)

Here, Number.IntegerDivide divides the months by 12. A dog that’s 38 months old is 3 full years old (38 / 12 is 3.17), and a 7-month-old cat is 0.
The column name has parentheses in it, so the code writes it as [#"Age (Months)"]. The #"..." wrapper is what lets Power Query read the parentheses, while a name with just spaces, like [Cases Ordered], works without it.
The square brackets around the name are simply how every column is referenced.
P-103 has no age in the table, so its cell comes into Power Query as null. Number.IntegerDivide returns null for it, so the blank stays blank instead of causing an error.
Example 4: Split a List of People into Teams of Four
Number.IntegerDivide is also a neat way to group rows. Below is a table named Volunteers with ten names, and I want to put them into teams of four, with the team number in a new Team column.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="Volunteers"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source,"Index",0,1,Int64.Type),
#"Added Team" = Table.AddColumn(#"Added Index","Team",each Number.IntegerDivide([Index],4)+1,Int64.Type)
in
#"Added Team"
Result: An Index column (0 to 9) and a Team column (1, 1, 1, 1, 2, 2, 2, 2, 3, and 3)

Here, the Table.AddIndexColumn function first numbers the rows 0, 1, 2, and so on. Then Number.IntegerDivide divides each index by 4.
Index 0 to 3 divided by 4 all give 0, index 4 to 7 give 1, and 8 and 9 give 2. Adding 1 turns those into teams 1, 2, and 3, so the last team has just two people.
The index starts at 0 on purpose. If it started at 1, the fourth person (index 4) would land in the next team.
To change the team size, swap 4 for the size you want.
Example 5: Group Ages into 10-Year Bands
Here’s another way to use the same idea. Below is a table named SurveyResponses with each respondent’s age, and I want an Age Group column that shows the 10-year band they fall in, like 30-39.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="SurveyResponses"]}[Content],
#"Added Age Group" = Table.AddColumn(Source,"Age Group",each let Start = Number.IntegerDivide([Age],10)*10 in Text.From(Start)&"-"&Text.From(Start+9),type text)
in
#"Added Age Group"
Result: A new Age Group column (30-39, 20-29, 40-49, 50-59, 20-29, and 30-39)

Here, Number.IntegerDivide([Age],10)*10 finds where each band starts. For an age of 34, 34 / 10 gives 3, and 3 x 10 gives 30.
The let Start = ... in part saves that number as Start, so the formula can use it twice. Text.From(Start)&"-"&Text.From(Start+9) then joins 30 and 39 into the label 30-39.
For bands of a different size, like 5 years, replace both 10s with 5 and the 9 with 4.
This works when every band is the same width. For uneven bands like 18-24 and 25-34, use an if-then-else formula or a lookup table instead.
Follow along with the example file
Number.IntegerDivide Function Examples.xlsx
Example 6: Get the Year from a Date Key Like 20260117
Many systems export dates as numbers like 20260117 (year, month, day). Below is a table named SalesExport with an order ID and a date key for each order, and I want the year in a new Year column.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="SalesExport"]}[Content],
#"Added Year" = Table.AddColumn(Source,"Year",each Number.IntegerDivide([Date Key],10000),Int64.Type)
in
#"Added Year"
Result: A new Year column (2025, 2026, 2026, 2026, and 2026)

Here, dividing by 10000 moves the decimal point four places to the left, so 20260117 becomes 2026.0117. Number.IntegerDivide drops everything after the decimal point and leaves the year, 2026.
This is the quickest route when you only need the year.
If you want the full date instead, use the Date.FromText function. For example, Date.FromText(Text.From([Date Key]),[Format="yyyyMMdd"]) turns 20260117 into 1/17/2026.
Important: If your date keys are stored as text, Number.IntegerDivide gives an error like We cannot convert the value “20260117” to type Number. Change the column to a number type first, or wrap it in the Number.From function.
Example 7: How Number.IntegerDivide Handles Negative Numbers
Negative numbers are where Number.IntegerDivide can surprise you. Suppose you divide -7 by 2, which is -3.5, and you want to know whether you get -3 or -4.
Create a new blank query and type this formula in the formula bar:
= {Number.IntegerDivide(-7,2),Number.RoundDown(-7/2)}
Result: A list with -3 and -4

Here, the first item uses Number.IntegerDivide and gives -3. Instead of rounding down, it cuts off the decimal part, which moves the answer toward zero.
The second item uses the Number.RoundDown function, which always goes to the smaller number. For -3.5, the smaller whole number is -4.
For positive numbers, both give the same answer (7 / 2 gives 3 either way). Only negative results differ.
This matches the QUOTIENT function in Excel, where =QUOTIENT(-7,2) also returns -3. The INT function works like Number.RoundDown and returns -4 for -3.5.
So if you need negative results to go down to the smaller number (for example, to put -3.5 into the -4 bucket), use Number.RoundDown(number1/number2) instead of Number.IntegerDivide, like the Number.RoundDown(-7/2) in this example.
Example 8: Why 1 Divided by 0.1 Gives 9
This one looks like a bug. Suppose you have 1 liter of sauce and fill bottles of 0.1 liters each, so you should get 10 bottles.
Create a new blank query and type this formula in the formula bar:
= {Number.IntegerDivide(1,0.1),Number.IntegerDivide(1,0.1,Precision.Decimal)}
Result: A list with 9 and 10

Here, the first item gives 9, which is wrong. By default, Power Query does this math with Precision.Double, which can’t store a decimal like 0.1 exactly, and here that’s enough to make the answer come out one short.
The second item adds Precision.Decimal as the third argument. That tells Power Query to do the math with exact decimals, so you get 10.
It doesn’t happen with every decimal. For example, 3 / 0.3 and 0.75 / 0.25 come out right, but 2 / 0.2 gives 9 and 1 / 0.05 gives 19.
So whenever the divisor has a decimal part, add Precision.Decimal. Whole-number divisors like 7, 12, or 60 don’t need it.
Example 9: Use Precision.Decimal on a Whole Column
Now let’s apply that fix to real data. Below is a table named RibbonSpools with how much ribbon is left on each spool and how much one bow needs, and I want the number of full bows in a new Bows column.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="RibbonSpools"]}[Content],
#"Added Bows" = Table.AddColumn(Source,"Bows",each Number.IntegerDivide([#"Ribbon Left (m)"],[#"Length per Bow (m)"],Precision.Decimal),Int64.Type)
in
#"Added Bows"
Result: A new Bows column (10, 15, 10, 4, and 20)

Here, Number.IntegerDivide divides the ribbon left by the length per bow, and Precision.Decimal makes it use exact decimals.
Without Precision.Decimal, the same column gives 9, 14, 10, 4, and 19. Three of the five spools would come out one bow short, and nothing on the screen would tell you.
Other Excel Articles You May Also Like:
- Number.Round – Use Number.Round in Power Query M to round numbers.
- Duration.TotalDays – Use Duration.TotalDays in Power Query M to get the days in a duration.
- Duration.Days – Use Duration.Days in Power Query M to extract the day component from a duration value.
- Date.Year – Use Date.Year in Power Query M to extract the year from a date.
- Number.ToText – Use Number.ToText in Power Query M to format numbers as text.
- Number.From – Use Number.From in Power Query M to convert values to numbers.
- Date.AddYears – Use Date.AddYears in Power Query M to add or subtract years from a date.
- Date.Month – Use Date.Month in Power Query M to get the month number from a date.