Performing Integer Divisions

Written by Allen Wyatt (last updated November 16, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


Greg needs to perform some integer divisions. It seems that Excel provides three functions that can be helpful: INT, TRUNC, and QUOTIENT. He's unclear, though, as to how these functions differ and which would be best for his purposes.

First, let's look at what the functions do. The INT function supposedly gives the integer portion of a value, though this doesn't exactly mean what you may think. What the function does is to return a rounded integer value, where the rounding is always toward the left on a number line. So, consider the following two formulas:

=INT(8/3)
=INT(-8/3)

The difference between the two, of course, is that the dividend in the first is positive and in the second is negative. The result of the first formula is 2, and the result of the second is -3. This is because, again, INT always rounds toward the left on a number line.

The TRUNC function, on the other hand, always returns the integer portion of a value. So, it does no rounding; it simply chops off (truncates) everything after the decimal point. When both dividend and divisor are positive or negative values, TRUNC returns the same thing as INT. When the dividend and divisor have different signs, then they provide different results because TRUNC does no rounding, just "chopping."

Finally, the QUOTIENT function returns the same thing as the TRUNC function. The difference between the two is that TRUNC does the division to derive the parameter necessary for the truncation, and QUOTIENT uses two parameters, being the dividend and divisor. The following provide the same result and illustrate the difference in specifying values for the functions:

=TRUNC(8/3)
=QUOTIENT(8,3)

There is one other thing that should be mentioned about the TRUNC function—it includes an option second parameter that allows you to indicate how many decimal places you want in the results. The default is 0, meaning it will return an integer value, as has been done in this tip so far. So, for integer division it is only suitable if you either leave off the second parameter or explicitly indicate that you want 0 digits after the decimal point:

=TRUNC(8/3)
=TRUNC(8/3,0)

So, which should you use? The determining factor will be the nature of the data you are working with. If you are going to be using mixed negative and positive numbers—where the result of the division will be negative—then you are best to go with either TRUNC or QUOTIENT. If your data is all positive, then it doesn't really matter which one you use.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13264) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Editing Custom Dictionaries

Custom dictionaries can be great, but they take quite a bit of time to create. Word provides a way you can edit your ...

Discover More

Appearance of Excel on the Taskbar

Do you want Excel to use a task button, on the Windows Taskbar, for each of your open worksheets? Then just make this ...

Discover More

Extracting a Pattern from within Text

If you have a large amount of data in a worksheet and you want to extract information from the text that meets certain ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Using the IF Worksheet Function

Programmers know that a staple of any language is the ability to create conditional statements. Excel understands this, ...

Discover More

Establishing a FLOOR and CEILING

Excel includes a surprising number of functions you can use to round your data. Two such functions are FLOOR and CEILING, ...

Discover More

Using COUNTIF with Colors

Excel allows you to easily format cells with different fonts, borders, and colors. If you want to count the number of ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 + 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.