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 in Excel 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

Read More: How to Use SIGN Function in Excel (7 Effective Examples)

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

Read More: 44 Mathematical Functions in Excel (Download Free PDF)

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

Read More: 51 Mostly Used Math and Trig Functions in Excel

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


Similar Readings


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

Md. Abdul Kader

Md. Abdul Kader

Hi! I am Abdul Kader and presently working as ‘Excel & VBA Content Developer’ at Exceldemy. I publish my articles related to Microsoft Excel here. In 2019, I completed my graduation in Urban and Regional Planning from Chittagong University of Engineering and Technology. Having extreme eagerness to learn, I want to develop my skills and capabilities higher.

2 Comments
  1. Hi Abdul,

    If it is unacceptable for me to ask for assistance on a problem, I apologize. Otherwise, I would love your input on the problem below.

    9/1/22 3/12/18 6:16
    9/1/22 13:30
    9/1/22 22:43
    9/1/22 10:09
    4/16/21 8:44
    9/1/22 13:11

    (Example above)

    I have a cell which contains a (reference) date (without a time).
    I have a column, each cell of which contains a date & time (various dates and various times). Some of the dates in the column equal the reference date.

    I want to find the MAX time, in the column, but only on the reference date. (The times on the other dates don’t matter.)

    The solution I’m looking for, in the example, would be 22:43, in cell C3, which is the maximum time on the reference date of 9/1/22.

    I’m pretty sure the INT function is involved but I haven’t gotten it to work yet.

    Thank you very much, in advance.
    Dave

    • Hello Dave,
      Thanks for your humble appearance. But we always welcome informing us about your concerns. Now, without further delay, let’s dive into the problem.
      At first, download the Practice Workbook for your own convenience.
      From your example above, I’ve created a dataset. Let’s look at the image below for a better understanding.

      • To solve the problem, firstly, we are creating a new column named Helper Column to Get Date Only. Also, created a final output range in cell D14.

      • Secondly, select cell D7 and enter the following formula.
      =DATE(YEAR(B7),MONTH(B7),DAY(B7))
      This formula filters out the date only from the date and time in cell B7.
      • Then, press the ENTER key.

      • After that, use the Fill Handle tool to get results in the remaining cells.

      • Thirdly, go to cell D14 and paste the formula below.
      =MAX(IF(D7:D12=D4,B7:C12))
      We used the MAX and IF functions in the formula above. Using the IF function, we inserted a logical test that checks if the dates in the D7:D12 range equals to the date in cell D4. If the result is TRUE, then it displays an array of corresponding dates and times in the B7:C12 range. Then, the MAX function gets the maximum value among them.
      • As usual, press ENTER.

      Currently, it’s showing the time in General format. So, we’ve to change the cell formatting.
      • To do this, press CTRL+1 to open the Format Cells dialog box.
      • In the Number tab, select Time format as Category.
      • Then, choose the formatting Type as shown in the picture below.
      • Lastly, click OK.

      Finally, we got our desired output format. And the result is correct also.

      That’s all about it. If you find any difficulty regarding this example or any other problems related to Excel, feel free to contact us. You can also follow our Exceldemy blog for the most detailed solutions to any problems in Excel.

Leave a reply

ExcelDemy
Logo