$$ rounding down $$ (1 Viewer)

toddbingham

Registered User.
Local time
Today, 15:58
Joined
Jul 8, 2003
Messages
93
Have currency coming over from a link table. Appending it to a table, running a query to select certain records off of the table. Have a report that makes it look pretty that is ran from the query. I need to be able to take the number (say $553.54) and have it round down to the nearest five dollar increment with .00 cents. So, I would need it to look like 550.00, how would I acheive this?

Thanks.
 

Mile-O

Back once again...
Local time
Today, 20:58
Joined
Dec 10, 2002
Messages
11,316
1. Divide it by 10
2. Use the Int function
3. Multiply by 10
4. Use the CCur function

i.e.

1. $553.54 / 10 = 55.354
2. Int(55.354) = 55
3. 55 * 10 = 550
4. CCur(550) = $550.00

Altogether, now:
=CCur(Int(MyMoney/10)*10)
 
Last edited:

dcx693

Registered User.
Local time
Today, 15:58
Joined
Apr 30, 2003
Messages
3,265
Mile-O-Phile said:
Altogether, now:
=CCur(Int(MyMoney/100)*100)

This version seems to work:
=CCur(Int(MyMoney/10)*10)

We know what you really meant Mile! :D
 

Mile-O

Back once again...
Local time
Today, 20:58
Joined
Dec 10, 2002
Messages
11,316
lol, i've been getting by zeros mixed up all this week.

I'm sure I meant by 10 and not 100 - I'm just losing the plot..!! :rolleyes:

Craftily edited it...
 
Last edited:

st3ve

Registered User.
Local time
Today, 20:58
Joined
Jan 22, 2002
Messages
75
Round down to multiple of 5

.....round down to the nearest five ...

ie. 554.43 to 550.00
557.76 to 555.00 etc

try this ... NewValue = 5 *int([OriginalValue]/5 )

HTH
 

toddbingham

Registered User.
Local time
Today, 15:58
Joined
Jul 8, 2003
Messages
93
Alright, both of these formulas work, but they do not give me the .00 on the end.
Any ideas? I can live without it, but it sure would be nice to have the .00 on there.

Thanks.
 

Mile-O

Back once again...
Local time
Today, 20:58
Joined
Dec 10, 2002
Messages
11,316
CCur(5 *Int([OriginalValue]/5 ))
 

toddbingham

Registered User.
Local time
Today, 15:58
Joined
Jul 8, 2003
Messages
93
That does not do it either. I also added an Inout mask of 0000.00;0;0
this added to . to the end but not the 0's
 

st3ve

Registered User.
Local time
Today, 20:58
Joined
Jan 22, 2002
Messages
75
.00

Oh yeah! Forgot that bit!

In the query, where you put in the formula to do the rounding, make sure that the properties of this new field (in the query) are set to Currency or Fixed.
 

Mile-O

Back once again...
Local time
Today, 20:58
Joined
Dec 10, 2002
Messages
11,316
This is getting ridiculous...

Format(5 *Int([OriginalValue]/5 ),"0.00")
 

Mile-O

Back once again...
Local time
Today, 20:58
Joined
Dec 10, 2002
Messages
11,316
lol, I wasn't referring to you but the amount of formulas that we're going through...

Did that last one work?
 

raskew

AWF VIP
Local time
Today, 14:58
Joined
Jun 2, 2001
Messages
2,734
Hmm,

From the debug window:

fmt = "$ ###,###.00"
x = 553.54
x = int(x/5)*5
? format(x, fmt)
$ 550.00

Does that work?

Bob
 

Users who are viewing this thread

Top Bottom