Google Exceltip.com
Account Icon
Shopping Cart
CheckOut

» Combining Numbers that Have Leading Zeros




Problem:

Column A (List1) is formatted to display a leading zero before each number. That is, "1" is displayed as "01", "2" as "02", and so on.
The following formula was created to concatenate the numbers from List1 into one string:
=A2&A3&A4&A5
However, an incorrect result of "1234" is returned.
How can we modify the formula to honor the leading zeros?

Solution:

Use the TEXT function as shown in the following formula:
=TEXT(A2,"00")&TEXT(A3,"00")&TEXT(A4,"00")&TEXT(A5,"00")

Rate this tip
12 34 5
  RATING: 4.52
  VIEWS: 14715
Thank you very much !!!
Ravee Mathi Sundar wrote on December 31, 1969 18:00 EST
Hi,
Thank you very much for letting me know about TEXT function. It was very helpful in solving one of main problem in displaying leading zeros using ASP in excel. Thanks again.

Cheers,
Ravee



REGISTERED USERS click here to post comments


GUESTSclick here to Register
Name
Comment Title
Comments


Terms and Conditions of use
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Copyright © 2003 ExcelTip.com
Microsoft, Microsoft Excel is a U.S. registered trademark of Microsoft Corporation