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)
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.
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.
The rounded integer portion of a decimal number
|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.
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:
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.
As the INT(C5) rounds down to the nearest integer number, you have to subtract this output from the decimal number.
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.
- How to Use SEQUENCE Function in Excel (16 Examples)
- LARGE function in Excel
- How to use RAND function in Excel (5 Examples)
- Use SUMPRODUCT Function in Excel (4 Examples)
- How to Use SUMIFS Function in Excel (6 Handy Examples)
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.
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.
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")
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
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|
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.
- How to Use MOD Function in Excel (9 Suitable Examples)
- Use FLOOR Function in Excel (11 Examples)
- How to Use ROUND Function in Excel (With 9 Examples)
- Use ROUNDUP Function in Excel (6 Examples)
- How to Use ROUNDDOWN Function in Excel (5 Methods)
- Exponential Notation E in Excel & How to Turn Off Auto Scientific Notation!
- How to Use SUM Function in Excel (With 6 Easy Examples)