View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson[_3_] Myrna Larson[_3_] is offline
external usenet poster
 
Posts: 45
Default Rounddown problem in VBA

There's a problem with your 2nd formula. If Number = -3892.1, it gives -3894. If Number = 0, the
result is -1.

To round a positive number down and a negative number up, you can use FIX, i.e.

=FIX(Number)

You can also use the worksheet functions ROUNDUP and ROUNDDOWN, as well as ROUND.

With Number = -3892.1, Fix, Round, and RoundDown all give -3892. RoundUp gives -3893.


On Tue, 28 Oct 2003 03:42:09 -0800, "Jeminar" wrote:

rounding down a number to the integer
<rounded down=INT(number)

rounding down a number and rounding up a negative
<rounded down=INT(number+SGN(number)/2-0.5)

rounding to somethign other than an integer
<rounded down to 1dp=INT(number*10)/10

using round function
<rounded down=application.round(......)

application.command(...) accesses the excel formulae





-----Original Message-----
Hie, i have problem rounding down a value using VBA. Can

you help?
.