ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   REMOVE LEADING ZEROS (https://www.excelbanter.com/excel-worksheet-functions/134844-remove-leading-zeros.html)

ichihina

REMOVE LEADING ZEROS
 
00456 Tickford Dr.----456 Tickford Dr.
0785 Fort St.----------785 Fort St.
000309 Old Rock Dr.--309 Old Rock Dr.

How do I remove the leading zeros for these addresses?

mikelee101

REMOVE LEADING ZEROS
 
Say your first address is in A1. Use this formula:

=SUBSTITUTE(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE( A1," ","%"),"0"," ")),"
","0"),"%"," ")

This will convert existing spaces to percent signs, then convert zeros to
spaces so it can trim the leading spaces. Then it replaces the spaces with
zeros and the percent signs with spaces. Therefore, if any of your addresses
have percent signs in them for any reason, this wouldn't work. You'd have to
choose another character to change the original spaces to, like ~ or ^ or
somesuch.

There might be an easier way to do this, but this should work.

--
Mike Lee
McKinney,TX USA


"ichihina" wrote:

00456 Tickford Dr.----456 Tickford Dr.
0785 Fort St.----------785 Fort St.
000309 Old Rock Dr.--309 Old Rock Dr.

How do I remove the leading zeros for these addresses?


Toppers

REMOVE LEADING ZEROS
 
=VALUE(LEFT(A2,FIND(" ",A2)-1))&MID(A2,FIND(" ",A2),255)

"ichihina" wrote:

00456 Tickford Dr.----456 Tickford Dr.
0785 Fort St.----------785 Fort St.
000309 Old Rock Dr.--309 Old Rock Dr.

How do I remove the leading zeros for these addresses?



All times are GMT +1. The time now is 12:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com