Consulting

Results 1 to 5 of 5

Thread: Solved: delete from nth character

  1. #1

    Solved: delete from nth character

    hy,
    have numeric data in sheet1
    -------A-------------------B
    1 23,222255566
    2 3,5539522
    3 28,4555222233
    ...

    need to delete everything after second decimal place

    -----A---------B
    1 23,22
    2 3,55
    3 28,45
    ...

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,366
    Location
    Presuming they are numbers, have you tried: =ROUND(A2,2)

  3. #3
    VBAX Regular
    Joined
    Dec 2007
    Posts
    21
    Location
    Try this

    [VBA]Sub ATest()
    Dim LR As Long, i As Long
    LR = Range("A" & Rows.Count).End(xlUp).Row
    For i = 1 To LR
    Range("A" & i).Value = Round(Range("A" & i).Value, 2)
    Next i
    End Sub
    [/VBA]

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,366
    Location
    Errr... You actually did not mention rounding. To just delete, maybe TRUNC()

    =TRUNC(A2,2)

  5. #5
    tnx
    both solutions worked

Posting Permissions

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