Using column with numbers and leading zeros

J

Jake

Hi,

I have a column with social security number where leding zeros occur
often. Excle strips them off, but I have gotten around this by defining
a custom format of '00000000000', which works fine.

However I also need to pick out certain digits from this number using
Left() and Mid(), and these functions does not take the 'artificially'
added zeading zero into account...

How can I in an excel cell convert the numeric values to strings with
leading zeros and that these leftpadded strings can be currectly
manipulated with Left() and Mid()

Thanks for a solution to this

geir
 
P

Patrick Molloy

you can set the cilumns format to be TEXT. which would preserve th eleading
zeros. Otherwise Excel sees the soc sec codes as regular numbers and hence
strips away the leading zeros

you could use =TEXT(LEFT("00000000000",12 -LEN(A1) ) & A1,"#")
 
L

Luke M

You could either change the format of the cell you are entering the data into
to text, and manually input the leading zeroes, or, use the TEXT function in
combination with Left() and Mid() such as:

=LEFT(TEXT(A2,"00000000000"),4)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top