Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Need a left pad formula method

I am using Windows XP and Office 2003.

I need a formula to left pad some ID numbers that contain both letters and
numbers and can be from three to seven characters in length so that all IDs
have ten characters. This conversion will occur in another column. For
example:

8912 would become 0000008912
42138A would become 000042138A

I tried: =Text(A1, "0000000") and this works great when the ID is all
numbers, but this fails if letters are involved.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Need a left pad formula method

Hi,
Assuming the originals are in Column A and you want the padded version
in column B this should work (you may have to format both columns as
text)

=REPT("0",10-LEN(A1))&A1

HTH,
OJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Need a left pad formula method

That works great! Thanks OJ! - and good night.

"OJ" wrote:

Hi,
Assuming the originals are in Column A and you want the padded version
in column B this should work (you may have to format both columns as
text)

=REPT("0",10-LEN(A1))&A1

HTH,
OJ


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need a left pad formula method

(you may have to format both columns as text)

Just to add then:

You don't need to format either column as text. the results will be text
irrespective of formatting.

--
Regards,
Tom Ogilvy


"OJ" wrote in message
oups.com...
Hi,
Assuming the originals are in Column A and you want the padded version
in column B this should work (you may have to format both columns as
text)

=REPT("0",10-LEN(A1))&A1

HTH,
OJ



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method 'Left' of object 'DataLabel' failed SysMod Charts and Charting in Excel 2 July 10th 09 04:21 PM
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Please post this thread a complete correct method, method about te Nast Runsome New Users to Excel 0 February 23rd 08 09:42 PM
Array Formula - using LEFT("text",4) in formula Andrew L via OfficeKB.com Excel Worksheet Functions 2 August 1st 05 02:36 PM
formula or method needed Bart[_4_] Excel Programming 1 April 18th 04 08:07 AM


All times are GMT +1. The time now is 07:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"