View Single Post
  #7   Report Post  
Sloth
 
Posts: n/a
Default

One small correction. . .

the format can be anything, including text. It really doesn't need any
leading zeros to begin with (for example using the left function given below
for a value of 123456 in cell A1 would yield 0012). If you don't mind it
being a number, the "00000000" custom number format is the best option in my
opinion.

As far as your original question about adding leading zeros to text, I can't
help you. Sorry. I assumed the TEXT function would fix the problem you
first had.

"Sloth" wrote:

Use the text function when pulling numbers if you want to keep the leading
zeros.

For isntance...
A1: 00011101
B1: =LEFT(TEXT(A1,"00000000"),4)
B1 outputs: 0001

To use your example...
A1: 00011110
B1: =MID(TEXT(A1,"00000000"),2,1)
B1 Outputs: 0

The numbers will have to be formatted with a custom format. I can't help
you if you still want it formatted like text.
Ie. Custom Format: 00000000

"haitch2" wrote:


Hi, im new to this forum so hello.

Ive been searching around the net for a solution but of yet have not
found one, so hoping that sombody will be able to give me a hand. (im
making a binary to decimal converter for my work at college, i no how
to do the actual code to convert it im just trying to make it neat)

Im trying to split a number with leading zeros. Im using the mid
function to split out the number but for some reson it wont see the
leading zeros

ie spliting 00011110
im using =MID(b4,2,1) which should bring up 0 but its counting the
characters from the first 1.

ive sort of found a temorary solution by converting it to text, but the
imputer has to remeber to put leading zeros on so it makes it 8
characters.

is there any way to make excel add the zeros on (in a text field) to
make it up to 8 characters what ever the imputer puts in.

Any help is much appreciated as im not very good at excell (know more
about access, thats were i got the mid function) so please dont be to
complicated

Thanks in advanced

Helen


--
haitch2
------------------------------------------------------------------------
haitch2's Profile: http://www.excelforum.com/member.php...o&userid=27677
View this thread: http://www.excelforum.com/showthread...hreadid=471900