Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Format Cells - Custom

I am trying to convert data I receive to a specific format. I receive social
security numbers as text, occasionally the file comes over without the dashes
between the numbers. I tried converting the text to number and then did a
custom format to include the dashes. This works however if the social has a
leading zero (0) did loses it when converted. Any suggestions?

Thanks
--
Pat
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Format Cells - Custom

Import the values as Text (leading zeros will remain) in column A. In B1
enter:

=IF(MID(A1,4,1)="-",A1,LEFT(A1,3)&"-"&MID(A1,4,2)&"-"&RIGHT(A1,4))

So if the dash is there, the value is displayed. If the dash is not there,
it is inserted in the correct places. Here is A1 thru B2:

123-45-6789 123-45-6789
012345678 012-34-5678

--
Gary''s Student - gsnu200787


"PatM" wrote:

I am trying to convert data I receive to a specific format. I receive social
security numbers as text, occasionally the file comes over without the dashes
between the numbers. I tried converting the text to number and then did a
custom format to include the dashes. This works however if the social has a
leading zero (0) did loses it when converted. Any suggestions?

Thanks
--
Pat

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom format for cells Liz Excel Discussion (Misc queries) 4 December 11th 07 11:08 AM
FORMAT Cells - Custom JHL Excel Discussion (Misc queries) 2 July 22nd 06 12:47 AM
Custom format for cells Jack Excel Discussion (Misc queries) 4 January 12th 06 01:21 PM
custom cells format puiuluipui Excel Discussion (Misc queries) 5 August 31st 05 07:54 PM
Custom Format Cells araki Excel Discussion (Misc queries) 2 May 24th 05 11:18 AM


All times are GMT +1. The time now is 01:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"