How to remove one leading zero but keep the rest?

fvisions

Board Regular
Joined
Jul 29, 2008
Messages
191
Office Version
  1. 365
Platform
  1. Windows
I have a very large file with valid numbers of 02, 002, 02.1. The file has 002, 0002, 002.1 - how do I remove just the first leading zero but keep the rest. There are also number without leading zeros so I can not use the text to column process. Is there a way to do this in VBA or Excel formula?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try This

Book1
AB
3022
400202
5002.102.1
62222
702
Sheet1
Cell Formulas
RangeFormula
B3:B6B3=IF(MID(A3,1,1)+0=0,"",MID(A3,1,1))&MID(A3,2,100)
 
Upvote 0
Change range references as required
Code:
Sub Maybe()
Dim c As Range
    For Each c In Range("C7:C" & Cells(Rows.Count, 3).End(xlUp).Row)
        If CDbl(Left(c, 1)) = Chr(48) Then c.Value = Mid(c, 2, 99)
    Next c
End Sub
 
Upvote 0
Perfect, thank you so much for the quick response and great advice.
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top