ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with variable division (https://www.excelbanter.com/excel-programming/383084-help-variable-division.html)

Gary Keramidas

help with variable division
 
i am using 2 variables, tmpWt and tmpTime. weight is in pounds, time is in
minutes.
they are both dimmed as double

the 2 variables always have to correct values, yet when i try to divide the
weight by the time, the number is always a whole number and it's always wrong.

for example:

tmpwt = 2000
tmpTime = 23.5294
ws2.Range("P" & nextRow).Value = tmpWt \ tmpTime
the value in the cell is 83.00
the correct answer is 85.00

another one:
tmpwt =120
tmpTime =1.666
the cell value is 60.00
the correct value is 72.28
i can put the variable values in cells adjacent to column P and they're right,
but the division is incorrect.

anyone know why?

--


Gary





Gary Keramidas

help with variable division
 
i found a stupid mistake, in one formula i had \ instead of /.

sorry.

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i am using 2 variables, tmpWt and tmpTime. weight is in pounds, time is in
minutes.
they are both dimmed as double

the 2 variables always have to correct values, yet when i try to divide the
weight by the time, the number is always a whole number and it's always wrong.

for example:

tmpwt = 2000
tmpTime = 23.5294
ws2.Range("P" & nextRow).Value = tmpWt \ tmpTime
the value in the cell is 83.00
the correct answer is 85.00

another one:
tmpwt =120
tmpTime =1.666
the cell value is 60.00
the correct value is 72.28
i can put the variable values in cells adjacent to column P and they're right,
but the division is incorrect.

anyone know why?

--


Gary








All times are GMT +1. The time now is 03:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com