Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Determining an Integer Value.
by Allen Wyatt
(last updated August 9, 2014)
VBA, true to its BASIC roots, provides a function to return the integer value of an expression. This means that anything to the right of the decimal point is truncated. Thus, if a formula would normally result in a value such as 18.73, then the integer value of that formula would result in 18.
The syntax for the integer function is as follows:
x = Int(y)
where x is the result and y is a value or an expression that evaluates to a value.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9931) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Determining an Integer Value.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Do you need to create a number of words or phrases where you only alter a few letters in each one? If the alterations follow ...Discover More
Macros can be used to change the formatting of your worksheet, if desired. One change you might want to make is to the height ...Discover More
When sharing workbooks with others, you may find that the macros in those workbooks may not work as you expect. This tip ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.