Solved

# Excel Number Formatting

Posted on 2007-03-30
1,138 Views
I am formatting data in an excel worksheet that will eventually be exported into a database.  I have a column of numbers that are for example 0.002563589623.  I need to shorten those to 0.0026.  When I use the format number option, it appears to be correct but in the formula bar it appears as original.  Is there a simple way to shorten the number completely without retyping the entire 14,000 cells?
0
Question by:mikemomyer

LVL 81

Accepted Solution

zorvek (Kevin Jones) earned 125 total points
ID: 18824805
I would not recommend doing that but, if you really want, here is macro that will round the selected cells:

Public Sub RoundNumbers()

Dim Cell As Range

For Each Cell In Selection
Cell = Round(Cell, 4)
Next Cell

End Sub

Kevin
0

LVL 5

Expert Comment

ID: 18830692
Hello mikemomyer,
There is also a way to change the numbers to the way they are displayed:

Tools---Options---Calculation-----
Under Workbook Options
Check the box ---->Precision as Displayed.

You will get a warning, but the numbers will be shown as you have them displayed.  Good Luck.

MVB

0

## Featured Post

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.