View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ENFGDC4S ENFGDC4S is offline
external usenet poster
 
Posts: 5
Default adding leading zero in Excel

The sub worked great! Thank you for your time and effort.
Eric

"Rick Rothstein (MVP - VB)" wrote:

Okay, see my response to Gary''s Student where the code I posted anticipated
the answer you gave.

Rick


"ENFGDC4S" wrote in message
...
The alpha character will be a single character and followed by up to 3
numerals.
There is a posibility of up to 4 numerals but does not happen much. 3
numerals will be fine
I would only need the leading zeros if the numeral is from 1 - 99, for
example,
C3,C34 would be C003,C034.
There is also a comma after each item.
These are Reference Designators on a printed wiring board and are used in
the parts list for idenification.

"Rick Rothstein (MVP - VB)" wrote:

I guess we should further clarify... is the part in front of the number
always a SINGLE letter character? Is the number part always going to be
three digits long? Any other info we should know?

Rick


"ENFGDC4S" wrote in message
...
This is where my problem is. Here is an example of one of the cells:
C5,C16,C30,C38,C54,C91,C98,C136,C147
I can have a few hundred of these alpha numeric characters in one cell.
Thanks for your time.

"Gary''s Student" wrote:

That's O.K. We can solve this.

In A1 thru A3 I entered:

R1
R12
R152


I put my formula in B1 thru B3 and see:

R1 R001
R12 R012
R152 R152

What do you see?


--
Gary''s Student - gsnu200744


"ENFGDC4S" wrote:

I could not get this to work.

"Gary''s Student" wrote:

=LEFT(A1,1) & TEXT(RIGHT(A1,LEN(A1)-1),"000")

--
Gary''s Student - gsnu200744