Reduce Decimal Places WITHOUT Rounding

Myriad_Rocker

Questioning Reality
Local time
Today, 09:03
Joined
Mar 26, 2004
Messages
166
Hey everyone! Hopefully, someone can help me with this. I've searched the forum and can't find anything on it.

I want to take a number and reduce the number of decimal places from 4 to 3 WITHOUT rounding it. Just chop off that 4th number...I don't care about it.

Examples:

243.4586 = 243.458
22.0541 = 22.054
5.8577 = 5.857
1,587.2556 = 1,587.255

Seeing as how the numbers can be in the 10's, 100's, and 1000's, I can't just use the LEFT function. :D That, of course, would be too easy.

Suggestions? Solutions?

Thanks in advance!
 
rounding

If you don't mibd using an expression in a query...


expr: Left([anumber],Len([anumber])-1)
 
That works but I forgot one thing.

The field will not always have 4 decimal places. Sometimes it will have 3, 2, 1, or even zero.
 
numbers

How many decimal places is there supposed to be in the final format then?
0?1?2?
 
Got it...

IIf(InStr([field],".")>0,(Left([field],(InStr([field],".")))) & (Mid([field],(InStr([field],".")+1),3)),[field])
 
Left([Field], InStr([Field],".")+3)
.
 
assume the field you wish to truncate is called var

use INT(var*1000)/1000 if var is negative or
FIX(var*1000)/1000 if var is positive

the Help file says
"Both Int and Fix remove the fractional part of number and return the resulting integer value.

The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8."
 

Users who are viewing this thread

Back
Top Bottom