• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Limit Currency to 2 decimal place

How to limit Currency to 2 decimal place?

Here is an Example.

Dim a As Currency

a = 352 * 242/ 25.5252

The a will return more than 2 decimal place, how to limit it to just 2 decimal place?

Thanks
0
trowa
Asked:
trowa
  • 2
1 Solution
 
appariCommented:
a=format(352 * 242/ 25.5252,"#,#0.##")
0
 
Arthur_WoodCommented:
appari,
   if you want to be sure that you ALWYS get the cents, then the format should be:

a=format(352 * 242/ 25.5252,"#,##0.00")

the .## notation will drop trailing 0's , using a 0 in the formatstring FORCES a zero in that place, no matter what.

0
 
appariCommented:
it depends on whether to display 0 cents or not. both the formats will give result.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now