Performing Integer Divisions

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


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, 2021, and Excel in Microsoft 365.

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

Counting Words

Do you need to know how many words are in a range of cells? Excel provides no intrinsic way to count the words, but you ...

Discover More

Updating Automatically When Opening Under Macro Control

If your workbook contains links, you are normally given the opportunity to update those links when you open the workbook. ...

Discover More

Automatically Determining a Due Date

When you are doing a mail merge in Word, you may need to calculate a date sometime in the future. Word doesn't include an ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Exact Matches with DSUM

The DSUM function is very handy when you need to calculate a sum based on data that matches criteria you specify. If you ...

Discover More

Using SUMIF with Text Parameters

The SUMIF function is supposed to work just fine doing comparisons with text values. This isn't a hard-and-fast rule, ...

Discover More

Specifying a Date Range in a SUMIFS Formula

The SUMIFS function allows you to specify criteria by which values can be included in a sum. Putting together the ...

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 nine more than 7?

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.