ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Round to 2 decimal places (https://www.excelbanter.com/excel-programming/439943-round-2-decimal-places.html)

petedacook

Round to 2 decimal places
 
Hello,

I am trying to round figures in a cell to the second decimal place....but I
cannot seem to do it and I cannot seem to find help in my books.

I have coe put together to put the figure in the cells, but it has many
decimal places.

This is what I have done so far and nothing:

Do While I <= 50
round(Cells(I, 3).Value,2)
I = I + 1
Loop

OR

Do While I <= 50
round(Cells(I, 3) ,2)
I = I + 1
Loop

Please help?



Mike H

Round to 2 decimal places
 
Hi,

try this

i = 1
Do While i <= 50
Cells(i, 3).Value = WorksheetFunction.Round(Cells(i, 3), 2)
i = i + 1
Loop


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"petedacook" wrote:

Hello,

I am trying to round figures in a cell to the second decimal place....but I
cannot seem to do it and I cannot seem to find help in my books.

I have coe put together to put the figure in the cells, but it has many
decimal places.

This is what I have done so far and nothing:

Do While I <= 50
round(Cells(I, 3).Value,2)
I = I + 1
Loop

OR

Do While I <= 50
round(Cells(I, 3) ,2)
I = I + 1
Loop

Please help?



Rick Rothstein

Round to 2 decimal places
 
Or, to stay with native VB functions, use...

Cells(i, 3).Value = Format(Cells(i, 3).Value, "#.##;;0")

--
Rick (MVP - Excel)


"Mike H" wrote in message
...
Hi,

try this

i = 1
Do While i <= 50
Cells(i, 3).Value = WorksheetFunction.Round(Cells(i, 3), 2)
i = i + 1
Loop


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"petedacook" wrote:

Hello,

I am trying to round figures in a cell to the second decimal place....but
I
cannot seem to do it and I cannot seem to find help in my books.

I have coe put together to put the figure in the cells, but it has many
decimal places.

This is what I have done so far and nothing:

Do While I <= 50
round(Cells(I, 3).Value,2)
I = I + 1
Loop

OR

Do While I <= 50
round(Cells(I, 3) ,2)
I = I + 1
Loop

Please help?





All times are GMT +1. The time now is 01:12 PM.

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