Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6658435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:54:49+00:00 2026-05-26T01:54:49+00:00

I am doing a calculation of values using Microsoft Excel vba. I have a

  • 0

I am doing a calculation of values using Microsoft Excel vba.

I have a portion of codes like the below:

INT(151.2 * 100)
I notice that the result from this calculation is 15119 but the correct result should be 15220.

It is ok if i remove the INT()
151.2 * 100
The result returned will be 15220.

Can anyone advise why is there such a difference and whether it is correct to simply remove the INT() to achieve the correct result?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:54:50+00:00Added an answer on May 26, 2026 at 1:54 am

    Floating-point arithmetic.

    a = (151.2 * 100)
    Print Int(a)
    15119
    Print a
    15120
    Print a = 15120
    False
    

    There is no double-precision number to represent the result of 151.2 * 100 exactly as 15120. The closest one is apparently just under 15120. When you Int it, it gets truncated, i.e. rounded down to 15119.

    Instead of truncating, you could round:

    Print CInt(a)
    15120
    Print Round(a)
    15120
    

    Note that if you have a variable i of type Integer and you just say i = 151.2 * 100 as you suggest, then you are implicitly coercing the result to an integer i.e. implicitly saying i = CInt(151.2 * 100). I think it’s better practice to be explicit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a probability calculation. I have a query to calculate the total number
I'm doing some calculation with numbers and would like to only print an integer
I have a fairly expensive array calculation (SpectralResponse) which I like to keep to
I have got this project that uses excel for some calculation. This excel is
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing some jquery animation. I have certain divs set up with an attribute of
I have a data.frame of cells, values and coordinates. It resides in the global
I'm doing some calculations that result in a value like {-0.707107, 9.61481e-017, 0.707107} when
We are using following fields to do some calculation. $(document).ready(function(){ $('.num').blur(function () { var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.