Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rounding in VBA
Hi Team,
I am facing a problem with rounding a number using VBA in excel. Let me explain with an example. suppose take 2 numbers 23.2067 and 23.2234. Now I need to round these 2 numbers to 2 digits. I am using application.round(number,2) to round up to 2 decimals. I am getting 23.2 and 23.22. But I want 2 digits after the decimal means for 23.2067 i want it to be 23.20. Can it be possible in VBA? when i am trying to do it by text(number,"0.00") its giving me an error sub function not defined. I have one alternative by using split function temp = split(application.round(number,2),".") and by calculating length of temp(1) I can know the number of digits after decimal. If i have only one number after decimal I can concatenate 0 with the number. this is a long process and in my macro this case may come once in 10000 calculatons. So can any body suggest an alternative way or easy way to handle this. Regards, Srinivas |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Rounding off | Excel Discussion (Misc queries) | |||
Rounding Up | Excel Discussion (Misc queries) | |||
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH | Excel Worksheet Functions | |||
I need a formula with rounding up & rounding down to the nearest . | Excel Worksheet Functions | |||
Worksheet rounding vs VBA rounding | Excel Programming |