ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Too Many Numbers After The Decimal (https://www.excelbanter.com/excel-discussion-misc-queries/97585-too-many-numbers-after-decimal.html)

RChicken

Too Many Numbers After The Decimal
 

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.


--
RChicken
------------------------------------------------------------------------
RChicken's Profile: http://www.excelforum.com/member.php...o&userid=33601
View this thread: http://www.excelforum.com/showthread...hreadid=558478


jetted

Too Many Numbers After The Decimal
 

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 Sub


--
jetted
------------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=558478


RChicken

Too Many Numbers After The Decimal
 

i'm sure that works, but i have no idea where to put that. Isn't there
just a find and replace to get rid of those extra numbers?


--
RChicken
------------------------------------------------------------------------
RChicken's Profile: http://www.excelforum.com/member.php...o&userid=33601
View this thread: http://www.excelforum.com/showthread...hreadid=558478


flummi

Too Many Numbers After The Decimal
 
Use the round () function like in

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

to round the result into 2 decimal places

Hans


RChicken schrieb:

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.


--
RChicken
------------------------------------------------------------------------
RChicken's Profile: http://www.excelforum.com/member.php...o&userid=33601
View this thread: http://www.excelforum.com/showthread...hreadid=558478



RChicken

Too Many Numbers After The Decimal
 

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


--
RChicken
------------------------------------------------------------------------
RChicken's Profile: http://www.excelforum.com/member.php...o&userid=33601
View this thread: http://www.excelforum.com/showthread...hreadid=558478



All times are GMT +1. The time now is 10:02 AM.

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