ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Number Format (https://www.excelbanter.com/excel-programming/408489-number-format.html)

DG

Number Format
 
I have a macro with the following formula

OnProdOrd = (Cells(x, 10) - Cells(x, 11) / Cells(x, 9))

I'll use x = 1 for the example

Cells(1,10) = 10
Cells(1,11)= 0
Cells(1,9)= 0.5
The problem is that in Cell(x,9) the value is 0.5. But the program must be
rounding to 1 or making it an integer because OnProdOrd = 10 when it should
be 20 (10 - 0)/0.5.

How do I correct this?

Dan



Per Jessen

Number Format
 
Hi

Just a little formula error (look at the parenthesises):


OnProdOrd = (Cells(x, 10) - Cells(x, 11)) / Cells(x, 9)

Regards,

Per

"DG" skrev i meddelelsen
...
I have a macro with the following formula

OnProdOrd = (Cells(x, 10) - Cells(x, 11) / Cells(x, 9))

I'll use x = 1 for the example

Cells(1,10) = 10
Cells(1,11)= 0
Cells(1,9)= 0.5
The problem is that in Cell(x,9) the value is 0.5. But the program must be
rounding to 1 or making it an integer because OnProdOrd = 10 when it
should be 20 (10 - 0)/0.5.

How do I correct this?

Dan




All times are GMT +1. The time now is 08:31 PM.

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