+ Reply to Thread
Results 1 to 4 of 4

Cell.Value to 2 decimal places

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-17-2006
    Posts
    152

    Cell.Value to 2 decimal places

    Hi,

    the code below takes the value of the cell which is often 3 to 5 decimal places and inputs the formula, however, how can i make VAR = only 2 decimal places insted of it absolute value
    i.e.

    A1 = 2.34678 So I want: -
    VAR = 2.35
    So the End result is
    '=SUM(2.35)*(1-C10)'

    NOT - '=SUM(2.34678)*(1-C10)'

    as this confuses people because they keep say the calculations are wrong because it is formatted in 2 decimal places.

    Cells(ROWPOS, 6).Select
        VAR = ActiveCell.Value 'assigns the current cell value to VAR
        Cells(ROWPOS, 6) = "= Sum(" & VAR & ")* (1-C10)"

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Jonn,

    Here is the conversion code..
    VAR=INT(A1*100)/100
    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor
    Join Date
    11-17-2006
    Posts
    152
    what does that formula do?

    Thanks

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Jonn,

    It strips away any decimals greater than 2. The number will only contain 2 decimal numbers after the decimal point. However, it does not round the second number off.

    Sincerely,
    Leith Ross

+ 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