ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formatting SSNs (https://www.excelbanter.com/excel-discussion-misc-queries/68534-formatting-ssns.html)

Cheri

Formatting SSNs
 
I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri

Kevin B

Formatting SSNs
 
You can place the following custom function in a VBA module by pressing
Alt+F11 and then clicking on Insert and selecting module.
-------------------------------------------------------------------------------------------------
Function SSN(Value As Long) As String

Dim strVal As String
Dim i As Integer

strVal = CStr(Value)
i = Len(strVal)

Do Until i = 9
strVal = "0" & strVal
i = Len(strVal)
Loop

SSN = strVal

End Function
-------------------------------------------------------------------------------------------------
Save a backup copy of your file before proceeding.

You can use this function like any other function. If your in cell B1 and
the SS# is in A1 type "=SSN(A1)" sans quotes to convert the number SS# to a
text string. You can then copy the column of formulas and paste
special/Values over the original number.

Kevin Backmann


"Cheri" wrote:

I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri


Doug Kanter

Formatting SSNs
 

"Cheri" wrote in message
...
I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri


What going to be done with these numbers after they're formatted this way?
That could be a factor in how you achieve your goal.



dlw

Formatting SSNs
 

=CONCATENATE(LEFT(A1,3),MID(A1,5,2),RIGHT(A1,4))


"Doug Kanter" wrote:


"Cheri" wrote in message
...
I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri


What going to be done with these numbers after they're formatted this way?
That could be a factor in how you achieve your goal.




Cheri

Formatting SSNs
 
I understand the formula but if I put it into a cell, how do I get the SSN
into the cell - if I paste it, it removed the formula.

Cheri

"dlw" wrote:


=CONCATENATE(LEFT(A1,3),MID(A1,5,2),RIGHT(A1,4))


"Doug Kanter" wrote:


"Cheri" wrote in message
...
I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri


What going to be done with these numbers after they're formatted this way?
That could be a factor in how you achieve your goal.




dlw

Formatting SSNs
 
you enter the ssn's in column A, you put the formula in column B, format
column A as text so the leading zeors stay.

"Cheri" wrote:

I understand the formula but if I put it into a cell, how do I get the SSN
into the cell - if I paste it, it removed the formula.

Cheri

"dlw" wrote:


=CONCATENATE(LEFT(A1,3),MID(A1,5,2),RIGHT(A1,4))


"Doug Kanter" wrote:


"Cheri" wrote in message
...
I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri

What going to be done with these numbers after they're formatted this way?
That could be a factor in how you achieve your goal.




Doug Kanter

Formatting SSNs
 
As Kevin B mentioned in his message, you'll have to use two columns to make
this trick work. Or, you could hide the original SSNs on a second sheet in
the workbook, and put this formula (or Kevin's suggestion) in the column
where you want the jazzed up SSNs to appear. You'd have to adjust the two
suggestions so they point to the second sheet.

"Cheri" wrote in message
...
I understand the formula but if I put it into a cell, how do I get the SSN
into the cell - if I paste it, it removed the formula.

Cheri

"dlw" wrote:


=CONCATENATE(LEFT(A1,3),MID(A1,5,2),RIGHT(A1,4))


"Doug Kanter" wrote:


"Cheri" wrote in message
...
I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri

What going to be done with these numbers after they're formatted this
way?
That could be a factor in how you achieve your goal.






Cheri

Formatting SSNs
 
I am still having difficulty with this concatenate formula. I have a
spreadsheet I need to import as a flat file. First I have to put info into
an Excel spreadsheet. If I use the concat formula, it appears in a column
that I cannot have in my spreadsheet becasue the import parameters are
already set. Column A is my SSNs. I cannot use them in the import with
hyphens and if zeros drop off. Can anyone help me to format Column A so
zeros don't drop off and hyphens go away? I can use Column H for a formula.
Please answer with lower level geek speak. Thanks

"Cheri" wrote:

I am trying to format a column of SSNs keeping any zeros in front and
dropping the hyphen. Can someone help me with this extra formatting?
Cheri



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

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