Too Many Numbers After The Decimal

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.
 
J

jetted

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
 
R

RChicken

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
 
F

flummi

Use the round () function like in

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

to round the result into 2 decimal places

Hans
 
R

RChicken

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