Formula Needed to Add Missing Leading Zeros to Number String

Vega10

New Member
Joined
Feb 21, 2013
Messages
7
Hello.

Thank you in advance for any help/guidance you all can provide.

My issue is as follows:
I have standardized report I use on a daily basis, this report contains social security numbers(SSN) without the leading zeros. I need to add the leading zeros to be able to use the correct SSN for other reporting needs.

I have tried to use the Special Number formatting for SSNs, the issue I have with this is that it only changes the appearance of the number, the actual number data does not change.

Is there a function, or set of functions I can use to easily add the leading zeros to a column?

Example below:
Current Report Style
Needed Report Style
35
0035
60522402
060522402

<TBODY>
</TBODY>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi and welcome to the forum,

I am not familiar with SSN's - what is the rule for determining how many leading zero's should precede each number?
 
Upvote 0
Hello!

It depends, it could be anywhere from 1 to 3. It's different for each SSN. The standard format of the SSN is 000-00-000, my report does not include the dashs and I have two reports, one with the full set of numbers (000-00-000) and one with the last 4 (0000).

Thank you,
EV
 
Upvote 0
Sorry - can you explain that again and maybe provide a few more examples?

What does it depend on? How do you know how many 0's you need to add to a given number?
 
Upvote 0
For the full set of numbers this should work

=REPT(0,8-LEN(A1))&A1

and for 4

=REPT(0,4-LEN(A1))&A1

Cheers, :)

 
Upvote 0
You are amazing, shawnhet! Truly!!

It worked, with one minor correction:

"For the full set of numbers this should work

=REPT(0,9-LEN(A1))&A1
"
For some reason the length of the full SSN registers as 9 not 8.

Thank you! Thank you!!!
and Thank you to circledchicken for trying. :)
 
Upvote 0
Social Security numbers are nine digits, not eight, with format of 000-00-0000. You need to change the above formula to =REPT(0,9-LEN(A1))&A1
 
Upvote 0
Yes, you are right! That was my mistake in my original posting. I forgot the last zero(0).

Thank you for the help! =)
 
Upvote 0

Forum statistics

Threads
1,215,493
Messages
6,125,128
Members
449,206
Latest member
burgsrus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top