Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 21
Talking Adding Text to a String

I have 6000 records of store numbers that are formated as text in column A. Some of the store "text" numbers have 2 characters, some have 3 and others have 4. I need to copy these stores numbers into column D, with a minimum of 4 characters. Those that only have 2 characters need to have 2 zeros added to the beginning of the store number and those that have 3 need to have 1 zero added to the beginning of the store number.

I tried to use the If(lenA2) 4, ("0"&A2),A2) however it only added one zero. How do I get it to add 1 zero if the store number is equal to 3 and 2 zeros if a store number is equal to 2.

Thanks for your help

Regards

Gene Haines
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default Adding Text to a String

You can use the TEXT function: =TEXT(A2,"0000")

Gene Haines wrote:
I have 6000 records of store numbers that are formated as text in column
A. Some of the store "text" numbers have 2 characters, some have 3 and
others have 4. I need to copy these stores numbers into column D, with
a minimum of 4 characters. Those that only have 2 characters need to
have 2 zeros added to the beginning of the store number and those that
have 3 need to have 1 zero added to the beginning of the store number.


I tried to use the If(lenA2) 4, ("0"&A2),A2) however it only added one
zero. How do I get it to add 1 zero if the store number is equal to 3
and 2 zeros if a store number is equal to 2.



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

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
How to convert a month to a quarter ...... Epinn New Users to Excel 26 May 3rd 23 07:45 PM
List File Properties - Author SS Excel Worksheet Functions 1 June 23rd 06 04:56 PM
How do I grab the date from a text string? [email protected] Excel Worksheet Functions 4 June 6th 06 07:55 AM
Find & Replace text format jmn13 Excel Discussion (Misc queries) 2 May 25th 06 06:18 PM
Extracting integers from a text string. Bhupinder Rayat Excel Worksheet Functions 10 September 28th 05 05:15 PM


All times are GMT +1. The time now is 10:13 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"