PDA

View Full Version : Solved: delete from nth character



thmh
08-27-2011, 08:12 AM
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
...

GTO
08-27-2011, 08:21 AM
Presuming they are numbers, have you tried: =ROUND(A2,2)

VoG
08-27-2011, 08:23 AM
Try this

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

GTO
08-27-2011, 08:24 AM
Errr... You actually did not mention rounding. To just delete, maybe TRUNC()

=TRUNC(A2,2)

thmh
08-27-2011, 08:39 AM
tnx
both solutions worked