How to Use INT Function in Excel (With 8 Examples)

INT Function in Excel (Quick View)

When you have a decimal number in your dataset, you can use the INT function to get the nearest integer.

This article will discuss the INT function, starting from the basics to the VBA code, including eight practical examples with proper explanations. So that you may adjust the formula for your uses.

INT Function in Excel (Quick View)

INT Function in Excel (Quick View)

Download Excel Workbook

Excel INT Function: Syntax & Arguments

Firstly, you’ll see the syntax and argument of the function. If you insert the function after entering equal sign (=), you’ll see the following figure.

The INT Formula

Summary

A decimal number can be represented as an integer using the INT function which rounds it down to the lowest integer portion. As the function reduces the number to the nearest integer; as a result, negative numbers become even more negative.

Syntax

=INT (number)

Return Value

The rounded integer portion of a decimal number

Arguments

Argument Required or Optional Value
number required The real number from which you want to get an integer

How to Use the INT Function in Excel ( Examples)

Example 1: Using INT Function when the Number is Positive

It’s a quite simple task to get the nearest integer from a given positive or negative decimal integer number.

For example, the INT function rounds down the weight from 50.78 kg to 50 kg.

Just use the following formula. For this, select a blank cell and insert the formula after entering an equal sign (=). Finally, press ENTER. If you want to use the same formula for other cells, you may use the Fill Handle Tool.

=INT(C5)

Using INT Function when the Number is Positive

Example 2: Using INT Function when the Number is Negative

The INT function reduces the number to the nearest integer. So that negative numbers become more negative (more away from 0). That’s why the function rounds 0.52 to 0 but rounds -0.52 to -1.

Besides, if you have negative numbers, in this case, the temperature, you can also use the INT function. The formula will be:

=INT(C5)

Using INT Function when the Number is Negative

Example 3: Using INT Function to Get Decimal Value

If you wish to get the only decimal value, you may also use the INT function. In that case, you have to insert the following formula.

=C5-INT(C5)

As the INT(C5) rounds down to the nearest integer number, you have to subtract this output from the decimal number.

Using INT Function to Get Decimal Value

Example 4: Using INT Function when the Serial Number has Decimal Value

Assuming that, birth date along with birth time is given, you need to get the birth date excluding the time.

As you know Excel stores dates as serial numbers, the time will be a decimal number included with the integer serial number. For example, 37115.52 refers to 12:24 on 8/12/2001.

How can you convert this?

It’s a simple process.

Use the Format Cells ( just press CTRL+1) or the VALUE function.

Then use the INT formula with the serial number as the argument.

Using INT Function when the Serial Number has Decimal Value

Example 5: Using INT Function to Split Date-Time

If you want to split date-time into separate dates and times, you can use the INT function.

Just insert the formula used in the earlier method to get the birth date. Then use the following formula to get birth time.

=C5-INT(C5)

Using INT Function to Split Date-Time

Example 6: Calculate the Number of Years between Two Dates Using INT Function

More importantly, you can calculate the number of years between two dates using the INT function.

For example, you can determine the age in years from the birth date.

For this, you have to use the YEARFRAC function which estimates the proportion of the year between two dates by the number of complete days.

Again, the TODAY function will be used to get the current date.

Then, the INT function rounds down the number of years to the nearest integer.

The formula will be like the following.

=INT(YEARFRAC(C5,TODAY()))

Calculate Age Using INT Function

Example 7: INT Function with IF Function

The IF function is the most popular function to make logical statements in Excel.

Also, you can utilize the INT function with the IF function.

Let’s imagine, you have thousands of data. Among them, some are integer data while some are floating data. Now, you have to identify whether the data are integer or not.

In such a situation, you can use the following formula.

=IF(C5>INT(C5),"Is not Integer", "Is Integer")

INT Function with IF Function

Example 8: INT Function Using VBA in Excel

If you have a larger dataset, it is time-consuming and a little bit boring to get the required result using a formula.

Rather you can utilize the VBA code in Excel which performs the result rapidly and accurately.

Now, let’s see how you can apply the VBA code to calculate the number of minutes.

Firstly, open a module by clicking Developer>Visual Basic>Insert>Module.

Then, copy the following code in your module.

Sub example_INT()
Range("D5").Value = Int(Range("C5"))
End Sub

Be careful that three things are essential to run the VBA code for using the INT function

  • Input cell range: Here, you have to insert the cell of the number from which you want to get the nearest integer e.g. B5
  • Output cell range: The cell range where you want to get the output.
  • Logic: The function is used e.g. INT

INT Function Using VBA in Excel

Other Rounding Functions

You can visit Excel Round Functions if you are interested to know.

Common Errors While Using the INT Function

Common Errors When they show
#VALUE! – Occurs when a text is inserted as input
#REF! – Occurs the input is not valid

Conclusion

This is how you can apply the INT function to get the row number. If you have an interesting and unique method of using the INT function, please share it in the comments section below.

Thanks for being with me.


Further Readings

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo