![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Jun 2003
Location: Arizona
Posts: 125
|
I have a column of Supplier IDs. Maximum number of characters is 9. If the supplier ID is not 9 characters long, it should have 0's placed in the front so that there are 9 characters. For example, Supplier ID is 487695. It should look like 000487695. I can get Excel to format the cells correctly by using the custom format. However, when I import into Access, it trims the 0's away even though the field is identified as text because the custom format does not actually change the "value" of the cell. It merely formats the cells.
How can I get this column to correctly import into Access from Excel? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Jun 2002
Location: Chicago, IL
Posts: 7,584
|
In a new column, use =TEXT(A1,rept("0",9)) and copy down. Use this new column for your import.
__________________
"The greatest challenge to any thinker is stating the problem in a way that will allow a solution." Bertrand Russell |
|
|
|
|
|
#3 |
|
Join Date: Jun 2003
Location: Arizona
Posts: 125
|
Thanks so very much! I knew it was simple, but I would have spent hours trying to figure that out. Never used rept before!
|
|
|
|
|
|
#4 |
|
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,018
|
If you suffer from a mild case of Redundantbracketphobia, you can also try:
=TEXT(A1,"000000000")
__________________
Barry- Photo Restoration/Enhancement http://www.smiledogproductions.com click below for detour
|
|
|
|
|
|
#5 |
|
Join Date: Sep 2008
Location: Pune, India
Posts: 25
|
What if i have a case like i need to extend my TEXT data to a particular length :
E.g. I have entries like - AAA BBBB CCCCC And i want - AAA@@ BBBB@ CCCCC Such that there are same number of characters in each cell in a column. Please provide a solution ? |
|
|
|
|
|
#6 |
|
Join Date: Jul 2004
Location: Rochester, NY
Posts: 2,794
|
How about:
=A1&REPT("@",MAX(5-LEN(A1),0))
__________________
Recent Draftee www.mrexcel.com/board2/viewtopic.php?t=199272 Recently came across a Free 1 GB Storage/File Sharing Site www.box.net |
|
|
|
|
|
#7 |
|
Join Date: Sep 2008
Location: Pune, India
Posts: 25
|
Thanks Dude...
That solved my problemmmm |
|
|
|
|
|
#8 |
|
Join Date: Jul 2006
Posts: 104
|
|
|
|
|
|
|
#9 |
|
MrExcel MVP
Join Date: Jan 2007
Location: Davis CA
Posts: 9,902
|
How about =LEFT(A1&"@@@@@@@@@",9)
|
|
|
|
|
|
#10 |
|
Join Date: Jul 2006
Posts: 104
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|