PDA

View Full Version : Decimal point.

NinjaTurtle
Aug 20th, 2002, 03:29 AM
dear,

i do the calculation of divide, and i get 7 decimal point values(23.1234567) but i want it to be 4 decimal digits : 23.1234

how? i tried Cdbl(Total) , but it still get the 23.1234567 and not 23.1234

webmarkart
Aug 20th, 2002, 03:47 AM
someone will correct me if I'm wrong, but maybe you could use the split function at the decimal point and the left function at 4 digits.

raf
Aug 20th, 2002, 08:42 AM
if you always have 7 values after the decimal point, then you can use this :

dim lenght
lenght = Len(string) - 3 'gives you the length - 3
Left(string,lenght) 'gives you the string without the last three caracters

you might also want to check on this :

using a split function on the decimal point is not the way to go. i'm from belgium an we are that crazy that we use the . and the , in the oppisite way. like this 20.000,32566 so if you would like to use a split unction, you should check the LCDI of the user

allida77
Aug 20th, 2002, 01:10 PM
Use the FormatNumber() (http://www.devguru.com/Technologies/vbscript/quickref/formatnumber.html) function. The split() function is for strings.

Roy Sinclair
Aug 20th, 2002, 02:42 PM
There's a data type just for currency.

Try: TheResult = CCur(operand) / CCur(Divisor)

TheResult should end up in currency format.

whammy
Aug 21st, 2002, 06:29 PM
<% = Round(23.1234567,4) %> will give you:

32.1235

Is that what you need? :D