MS Access Int() Function: Get the Integer Part of a Number
Learn how to use the MS Access `Int()` function to extract the integer portion of a number, effectively removing the decimal part. This guide explains the function's behavior with both positive and negative numbers, including the important distinction that `Int()` rounds negative numbers down to the nearest integer. Improve your number manipulation skills in Access with this practical guide.
Definition and Usage
The Int()
function in MS Access returns the integer part of a number. In simpler terms, it removes any decimal portion of a number.
Important Note: If the number is negative, Int()
returns the first negative integer less than or equal to that number. For example, Int(-3.5)
would return -4.
Syntax
Syntax
Int(number)
Parameter Values
Parameter | Description |
---|---|
number |
Required. A numeric value. |
Examples
Example 1: Returning the Integer Part of a Number
Example
SELECT Int(756.43) AS IntNum;
Output
IntNum
-------
756
Example 2: Returning the Integer Part from a Column
This example shows how to apply the Int()
function to a column within a table (e.g., a "Price" column in a "Products" table).
Example
SELECT Int(Price) AS IntNum FROM Products;
Output
(This output will vary depending on the data in the Products table. It will show the integer part of each Price.)
Technical Details
The Int()
function works in MS Access versions from 2000 onwards.