Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry I don't have a copy of the source code handy, but here goes:
I'm reading values from a series of cells in one sheet (stored in a 2D array), then accumulating values in a destination sheet. The array is type Double; using XL2002. The source data goes to three decimal places (ex. 0.245), but the value accumulated is rounded (ex. 0.25). Source Sheet reading: ActiveCell.Offset(Row, Column).Value = dblArray(RV,CV) Destination Sheet accumulating: ActiveCell.Offset(Row, Column).Value = ActiveCell.Offset(Row,Column).Value + dblArray(RV,CV) -Glenn Any clue as to why this is happening? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
? ActiveCell.NumberFormat
$#,##0.00 ? typename(activecell.Value) Currency -- Regards, Tom Ogilvy Ron Rosenfeld wrote in message ... On 25 Jan 2004 08:12:16 -0800, (Glenn Ray) wrote: "Pecision as Displayed" is turned off. Format for both source and destination cells is "$0.00" (Currency, "$", 2 digits). I actually solved the problem last night by making the following change in the accumulating formula: Destination Sheet accumulating: ActiveCell.Offset(Row, Column).Value = _ ActiveCell.Offset(Row,Column).Value2 + dblArray(RV,CV) This corrected the rounding I was seeing, but I didn't expect the error in the previous case in any regard. I don't believe there should be any difference between Value and Value2 unless you were using Currency or Date data types. But if the format of the destination cells is set to 2 digits, then the display in those cells will be arithmetically rounded to two digits. So 0.245 will be displayed as 0.25; although the contents of the cell should still be 0.245. You could determine the latter by temporarily reformatting the cell to have more decimal digits. --ron |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sun, 25 Jan 2004 14:30:43 -0500, "Tom Ogilvy" wrote:
? ActiveCell.NumberFormat $#,##0.00 ? typename(activecell.Value) Currency Aha! That's why Value2 works differently than Value in this instance. Thanks for the info. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
On exit from edit, Excel jumps to remote undesired cell. | Excel Discussion (Misc queries) | |||
Undesired links: Pasting from one excel document to another | Links and Linking in Excel | |||
Rounding up values | Excel Worksheet Functions | |||
accumulating values generated daily | Excel Worksheet Functions | |||
Accumulating Values in a Pivot table | Excel Discussion (Misc queries) |