1,105,556 Community Members

VB SCRIPT Rounding

Member Avatar
jcb0806
Newbie Poster
14 posts since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Using VbScript::

I have a list of several different prices and I'm trying to figure out how to round these 5 decimals adding zeros if necessary.

For example:

I want
2.84
3.1
4.896

to look like
2.84000
3.10000
4.89600

Can somebody please help me? Thanks!

Member Avatar
GeekByChoiCe
Master Poster
701 posts since Jun 2009
Reputation Points: 152 [?]
Q&As Helped to Solve: 170 [?]
Skill Endorsements: 3 [?]
Featured
 
0
 
Dim num1 As Double = 2.8399999999999999
		Dim num2 As Double = 3.1000000000000001
		Dim num3 As Double = 4.8689999999999998

		Debug.WriteLine(num1.ToString("F5"))
		Debug.WriteLine(num2.ToString("F5"))
		Debug.WriteLine(num3.ToString("F5"))

Retruns:
2,84000
3,10000
4,86900

Member Avatar
codeorder
Postaholic
2,027 posts since Aug 2010
Reputation Points: 197 [?]
Q&As Helped to Solve: 390 [?]
Skill Endorsements: 10 [?]
 
0
 
Member Avatar
jcb0806
Newbie Poster
14 posts since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks to all the responses. I used

formatnumber(2.84, 5)

made it look like 2.84000

Again appreciate all the help!

Question Answered as of 3 Years Ago by GeekByChoiCe and codeorder
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: