?
Solved

return integer

Posted on 2006-03-31
6
Medium Priority
?
146 Views
Last Modified: 2010-05-18
Hi,

Please kindly assist how can we return the whole number if the value we have has a decimal?

1.34  -return 1
123.45 -return 123


Thanks.
0
Comment
Question by:DexterJones
  • 3
  • 3
6 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 1600 total points
ID: 16341924
Hi DexterJones,

Use the Int() function to return the greatest integer that is less than or equal to the input value:

Answer = Int(SomeVar)

Regards,

Patrick
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16341926
CInt(number)
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 16341937
DexterJones,

Int(3) = 3
Int(3.3) = 3
Int(3.9) = 3

Int(-4) = -4
Int(-4.1) = -5
Int(-4.9) = -5

Regards,

Patrick
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 16341945
DexterJones,

Keep in mind that CInt will round a number, while Int I explained what Int does in my first post.  Which is it that you need?

Regards,

Patrick
0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 400 total points
ID: 16342105
Patrick, don't forget Fix() and implicit conversion.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16342184
or CLng() or even 123.45\1
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month17 days, 9 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question