Remove leading zeroes

jplank

Board Regular
Joined
Sep 19, 2012
Messages
62
I have a column of numbers:

000,093,425
000,391,156.42
000,124,231,113.02
000,001,201.01

I want to remove all leading zeroes and convert the data to:

93,425
391,156.42
124,231,113.02
1,201.01

Is there a simple way to do this?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Welcome to the Board!

First, make sure that the leading zeroes are really there, and not just formatted to look that way.
Just pick a value with leading zeroes, and look at the formula bar. If the leading zeroes are not displayed there, all you need to do is change your format on the whole column to Number with a 1000 separator (comma).

If you see the leading zeroes there, then first change your format on the whole column to Number with a 1000 separator (comma).
Then highlight the whole column and go to the Data menu, select Text to Columns, and click Finish.
This should convert all your entries to Numbers like you want.
 
Upvote 0
Hi,
let Your Data be in A1:A4, then try to run a Code of the form:
Code:
Sub yyy()
Dim i&, a As String

For i = 1 To 4
  a = Cells(i, 1).Value
  a = Replace(a, 0, "")
  Do Until Left(a, 1) <> ","
  a = Right(a, Len(a) - 1)
  Loop
  Cells(i, 2).Value = a
Next i
End Sub
Best regards.
 
Upvote 0
=IF( LEFT(A1) = "0", RIGHT(A1, LEN(A1)-5), A1)
Here the leading zeros are different for different case so you need to change the length like Len(A1)-4 for 000,391,156.42
 
Upvote 0
The zeroes are showing up in the formula bar. I followed your steps. I changed the format by going to More Number Formats and selecting Number with the 1,000 separator. Then I selected Text to columns, didn't change any of the default settings and clicked Finish. The zeroes are still there.
 
Upvote 0
I just tested it and see what you mean. If it is a Text entry (so those leading zeroes are actually in there), the Text to Columns method will not work because of the physical presence of the commas. But there is a way that is even easier still.

First, format the column as Number with the Thousands separator.
Then simply do a "Find and Replace" on that column replacing a single comma (,) with nothing.
It will convert all entries to numbers, thereby dropping the leading zeroes.
 
Upvote 0
=IF( LEFT(A1) = "0", RIGHT(A1, LEN(A1)-5), A1)
Here the leading zeros are different for different case so you need to change the length like Len(A1)-4 for 000,391,156.42

Hi kate middleton: Your Solution is effective for One Cell, we look for an automatic Solution for Range... :)
 
Last edited:
Upvote 0
I just tested it and see what you mean. If it is a Text entry (so those leading zeroes are actually in there), the Text to Columns method will not work because of the physical presence of the commas. But there is a way that is even easier still.

First, format the column as Number with the Thousands separator.
Then simply do a "Find and Replace" on that column replacing a single comma (,) with nothing.
It will convert all entries to numbers, thereby dropping the leading zeroes.

Worked perfectly! Thanks.
 
Upvote 0

Forum statistics

Threads
1,215,407
Messages
6,124,723
Members
449,184
Latest member
COrmerod

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