ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FormatZipCode (https://www.excelbanter.com/excel-programming/276429-re-formatzipcode.html)

Dave Peterson[_3_]

FormatZipCode
 
=TRIM(G2)&", "&H2&", "&I2&", "&K2 & text(L2,"00000-0000")

if L2 contained the 9 digit zip (stored as a number).

Maybe this would be better:

=TRIM(G2)&", "&H2&", "&I2&", "&K2 &TEXT(L2,"[<100000]00000;00000-0000")

It'll handle 5 and 9 digit zipcodes.



jb wrote:

I have a cell with the Zip Code format set to add the - if it is a 9
digit code. I am copying the Street Address, City, State and Zip to
another column in the spreadsheet using the following:
=TRIM(G2)&", "&H2&", "&I2&", "&K2. Everything copies over except the -
in the zip code. What would be the correct formula to get the -
inserted in the zipcode?

Thanks


--

Dave Peterson



All times are GMT +1. The time now is 08:31 AM.

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