Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi all,
I wrote the following function . But in some time the result is showing wrong format. When VarSum gets value 185.42 and ValueSum gets -185.42 the result should be 0. VarSum = VarSum + ValueSum 0= 185 + - 185 . But some cases Excel shows the balance as 8.5265128E-14. Please help. I given the function below. Sub CashBookMacrosnew() Dim VarSum As Double Dim ValueSum As Double Dim VarSumOld As Double Dim totalsum As Double lastrow = Range("B" & Rows.Count).End(xlUp).Row currow = ActiveCell.Row pre_row = ActiveCell.Row Col_A = "" For RowCount = 1 To lastrow If RowCount 1 Then pre_row = RowCount - 1 If Range("A" & RowCount) < "" Then VarSumOld = VarSum VarSum = Range("R" & RowCount) Range("Y" & pre_row) = VarSumOld Else ValueSum = (Range("R" & RowCount) + Range("S" & RowCount) + Range("T" & RowCount) + _ Range("U" & RowCount) + Range("V" & RowCount) + Range("W" & RowCount) + _ Range("X" & RowCount)) VarSum = VarSum + ValueSum End If End If Next RowCount End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Min of formula equals coming up wrong | Excel Discussion (Misc queries) | |||
excel result return wrong calcuation result | Excel Worksheet Functions | |||
excel result return wrong calcuation result | Excel Worksheet Functions | |||
excel result return wrong calcuation result | Excel Worksheet Functions | |||
Summing a column, result coming up 0 | Excel Discussion (Misc queries) |