"Round" a number...

1. Senior Member
Join Date
Dec 1969
Posts
1,100

## "Round" a number...

Hi,<BR><BR>I have this number (just an example): 30.49<BR>If I use round(30.49) it gives me 30.<BR><BR>I want to give me 31. Is this possible?<BR><BR>Thanks,<BR>Mircea

2. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE:

Dim dblToRound: dblToRound = 30.49<BR>Dim intRounded: intRounded = Int(dblToRound)<BR>if CDbl(dblToRound) &#060;&#062; Int(dblToRound) then intRounded = intRounded + 1<BR><BR>Of course, that&#039;s not going to work if the size of the value gets above 32000...<BR><BR>Craig.

3. Senior Member
Join Date
Dec 1969
Posts
1,100

## RE: It worked but what means "CDbl" ?

Thanks.<BR><BR>It worked.<BR><BR>BTW, what does "CDbl" ?<BR><BR>Mircea

4. Senior Member
Join Date
Dec 1969
Posts
1,100

## RE:

And if I want to round the number from 30.49 to 30.50?<BR>How do I do this?<BR><BR>Thanks,<BR>Mircea

5. Senior Member
Join Date
Dec 1969
Posts
102

## Easier way......

For any size number :<BR><BR>dim ToRound,RoundedUp<BR>ToRound = 123456789.49<BR>RoundedUp = Round(ToRound + 0.5)<BR><BR><BR>--<BR>Anglo Saxon<BR>

6. Senior Member
Join Date
Dec 1969
Posts
1,100

## RE:

Sorry for putting another question...<BR><BR>And if I have the number 30.495 or 30.49876... how can I manage to have only 30.49 (getting rid of the rest of the decimal numbers)?<BR><BR><BR>Thanks,<BR>Mircea<BR>

7. Senior Member
Join Date
Dec 1969
Posts
102

## RE:

Look up the syntax!<BR><BR>Round(expression[, numdecimalplaces])<BR><BR>Arguments :<BR><BR>expression <BR>Required. Numeric expression being rounded. <BR><BR>numdecimalplaces <BR>Optional. Number indicating how many places to the right of the decimal are included in the rounding. If omitted, integers are returned by the Round function. <BR><BR><BR>--<BR>Anglo Saxon<BR>

8. Senior Member
Join Date
Dec 1969
Posts
1,100

## RE: Aha...

Got it !<BR><BR>Thanks,<BR>Mircea

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•