Too Many Numbers After The Decimal

  • Thread starter Thread starter RChicken
  • Start date Start date
R

RChicken

I'm trying to update the prices of several thousand products, so i'm
useing the vlookup function, but the prices that are getting displayed
have 5 or 6 numbers after the decimal. how can i condense this down
into only 2 without using the format option.
 
You can try this code

Sub round_2_decimal()
'assuming the data is column a
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 1 To rowcount
Range("a" & i).Select
valu = ActiveCell.Value
valu = Round(valu, 2)
ActiveCell = valu
Next
End Su
 
i'm sure that works, but i have no idea where to put that. Isn't ther
just a find and replace to get rid of those extra numbers
 
Use the round () function like in

=round(vlookup(...);2)

to round the result into 2 decimal places

Hans
 
nevermind i got it and it didn't work, so i had to correct you
spellings of valu with value and now it works
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top