• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 495
  • 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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