LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Returning just the integer portion of a number

How do I return the integer portion of a number? for example 508.5 or
508.49 or 508.51 all should return 508

I have tried this::

Sub test()
Dim anyNum As Double
Dim I As Integer
anyNum = 508.51
I = anyNum \ 1
MsgBox I
End Sub


However, VB is first rounding anyNum in I = anyNum \ 1 and then doing the
\ 1 operation. Thus 508.51 returns 509 instead of the desired value of 508.

Thanks in advance!



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Buttons in lower portion of workbook appear in upper portion ToferKing Excel Programming 1 April 22nd 06 06:46 PM
funtion to determine the fraction portion of a number? Bertus Excel Worksheet Functions 1 April 21st 06 09:28 AM
Returning an integer from a Function WannaBeExceller Excel Programming 4 January 18th 06 10:43 PM
how do i operate on the decimal portion of a number maintchief New Users to Excel 3 October 24th 05 06:43 PM
Display ONLY fraction portion of number John F Excel Discussion (Misc queries) 4 January 6th 05 03:49 PM


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"