Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Formatting a cell impacts the way that the value is displayed, but does not
change the value itself (unrounded). If you want to calculate with rounded values, you either have to explicitly round them, or set the Precision as Displayed option. When you are unsure how to program an operation, record a macro while you do it manually and examine the code. From that you would find ActiveWorkbook.PrecisionAsDisplayed = True Jerry "Mike" wrote: Also, what I don't understand is why the extra decimal positions were there in the first place. The number I enter using the program had already been rounded to a single decimal point. Why did excel generate the extra positions? Mike "Bob Umlas, Excel MVP" wrote: Format the cells with one decimal place, then use Tools/Options/Calculation tab, and check "Precision as displayed". Click OK to the message about losing accuracy. Bob Umlas Esxcel MVP "Mike" wrote: I'm having a problem with rounding that I hope someone can help with. I've written code in VB to take readings from a piece of test equipment and round the value to a single decimal point before putting it into a spreadsheet. The problem is that the actual values in the cells have 13 decimal places. The cells are formatted as a number with one decimal place and that is how they are displayed in the cell of the spreadsheet. But, when I click on the cell and the actual value in shown in the Formula Bar, it shows the value with 13 decimals places. Code: Dim TempStr As Single TempStr = Round(Mid(ValueStr, 2, 14), 1) Sheets("Temps").Cells(Rrow, (X * 2)) = TempStr Results: Cell Shows in Formula Bar 23.7 23.7000007629394 23.8 23.7999992370605 23.9 23.8999996185302 24.0 24 24.1 24.1000003814697 24.2 24.2000007629394 24.3 24.2999992370605 24.4 24.3999996185302 24.5 24.5 24.6 24.6000003814697 24.7 24.7000007629394 24.8 24.7999992370605 24.9 24.8999996185302 25.0 25 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Importing from Excel Sheet Problem | Excel Discussion (Misc queries) | |||
Rounding to the Nearest Eighth | Excel Discussion (Misc queries) | |||
Excel Startup Problem | Excel Discussion (Misc queries) | |||
Averaging and Rounding problem | Excel Worksheet Functions | |||
Freeze Pane problem in shared workbooks | Excel Discussion (Misc queries) |