+ Reply to Thread
Results 1 to 5 of 5

Too Many Numbers After The Decimal

  1. #1
    Registered User
    Join Date
    04-18-2006
    Posts
    15

    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.

  2. #2
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363
    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

  3. #3
    Registered User
    Join Date
    04-18-2006
    Posts
    15
    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?

  4. #4
    Registered User
    Join Date
    04-18-2006
    Posts
    15
    nevermind i got it and it didn't work, so i had to correct your spellings of valu with value and now it works.

  5. #5
    flummi
    Guest

    Re: 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



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1