View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Inserting Characters

On Fri, 18 Aug 2006 11:16:29 -0400, rae820
wrote:


So I have a column of zip codes - some with 5 numbers and some with 9.
What I am trying to do is create a formula where if there are more than
5 characters in that cell, insert a "-" after the 5th character from the
left...does anyone know how to do that?

what I am trying to do...
befo
503122540

after:
50312-2540

without going through each cell manually!

Thanks


=TEXT(A1,"[99999]00000-0000;00000")

will do what you describe and also retain any leading zeros.
--ron