Excel – Best way to remove leading zeros from a non-numeric value in Excel

microsoft excelworksheet-function

I have many cells in an Excel sheet, using 9 characters of 0-9 and A-Z, that have some number of prefixed zeros:

000000123 
000001DA2 
0000009Q5
0000L210A
0000014A0
0000A5500
00K002200

I'd like to remove the leading zeros so that the values become:

123 
1DA2 
9Q5
L210A
14A0
A5500
K002200

How would I do this in an Excel formula? I'd prefer to avoid use of a VBA macro.

Best Answer

Here's a solution that's cell-intensive but correct.

Put your data in column A.

In B1, put the formula:

=IF(
    LEFT(A1) = "0" ,
    RIGHT(A1, LEN(A1)-1),
    A1)

This checks for a single leading zero and strips it out.

Copy this formula to the right as many columns as there can be characters in your data (9, in this case, so you'll be going out to column J). Copy it down for each row of data.

The last column contains your data, stripped of leading zeros.