There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Tag Cloud
audio bios blue screen boot bsod computer connection crash dcom dell driver drivers email error excel firefox google hard drive hardware hijackthis internet laptop logon logs off macro malware microsoft motherboard network networking problem ram recovery router screen slow software sound trojan usb userinit.exe virus vista webcam wifi windows windows 7 windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Excel 2k missing zeros after dec point

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
swamiji's Avatar
Junior Member with 6 posts.
 
Join Date: Nov 2003
12-Nov-2008, 11:32 PM #1
Excel 2k missing zeros after dec point
Hi. Using excel 2000 under Win-XP. While using my own VBA program to calculate a few simple figures and display them in a cell, I have noticed that the ROUND(x,n) function is returning 8.5 instead of 8.50, even though all appropriate fields are DIM'd as Currency.

Everything else works fine. Unfortunately, this means that I have to live with displays like this:
$45.89, $56.8,$43.09 etc. I place all the figures in the same cell, so excel puts them there as a string, which is fine. Whilst using the VB editor, I can see that it is the ROUND function (or maybe excel itself) which is truncating the trailing zero.

Other than writing a special routine to add a trailing zero, is there something else I can do?
(I am leery of using a global STYLE setting because of potential complications).

Perhaps someone knows of a better ROUND function or Sub?
I assume that this is a bug in Excel, since I can't imagine why anyone would want to show an amount with only one decimal place where a zero is involved.

PS: I realize that I could give each amount its own cell and use a format to fix it that way, but I prefer to have a series of amounts separated by commas in one cell, in this case.

Thanks.

Feel free to email me directly.
bomb #21's Avatar
Distinguished Member with 7,458 posts.
 
Join Date: Jul 2005
Location: The void AKA edge of the Fens
Experience: I bent my wookie :(
13-Nov-2008, 05:04 AM #2
"Other than writing a special routine to add a trailing zero, is there something else I can do?"

Not sure what lengths you don't want to go to. Have you tried (e.g.):

x = Format(Round(x, n), "$0.00") & ", "

etc?
swamiji's Avatar
Junior Member with 6 posts.
 
Join Date: Nov 2003
13-Nov-2008, 05:36 PM #3
Smile Trailing Zeroes missing
Thanks Bill. I never needed to use that format command within VBA before. It works! However, at first it didn't, since I had Dimmed the fields as Currency.
Once I changed the Dim lines for the fields (your x) to Strings, then all went fine.

Thanks again.

Swamiji
Closed Thread Bookmark and Share   techguy.org/768775

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 03:38 PM.
Copyright © 1996 - 2010 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.