+ Reply to Thread
Results 1 to 3 of 3

How do I truncate a number using VB

  1. #1
    Registered User
    Join Date
    01-17-2007
    Posts
    11

    How do I truncate a number using VB

    Help!

    Does anyone know I can truncate a number using VB

    For instance I want to truncate 13.32679 to 2 decimal places to end up with 13.32. Rounding or formating the cells to 2 decimal places will not work.

    Here is sample code whose result I want trancated
    Cells(RowNum, "C") = (Cells(RowNum, "A").Value / 100) * Cells(RowNum, "B").Value)

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    I don't know whether there is a truncate function in VBA. If there is, I'm sure someone will chime in. However, here is a work-around:

    INT([your_formula]*100)/100

  3. #3
    Registered User
    Join Date
    01-17-2007
    Posts
    11
    Thanks J, Your formula works fine.

    Thank you.

+ 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