Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating a full path, need help with leading zero's
I need to format a series of numbers that are of different lengths to have
leading zeros to be 7 digits. I need these to be able to be merged with 2 other cells to create a field that is a path to photos, to use in a Publisher merge. So in cell A1, I have the first part of the path: C:\Documents and Settings\My Documents\My Pictures\F. In cell B2 I have the numbers (different numbers like 9, 40, 123, 4567, and 34567) that need to go after the path. Then I have in cell C2 I have .jpg. If I use format, custom, 0000000 it works until I merge the cells together. When they are merged I get C:\Documents and Settings\My Documents\My Pictures\F40.jpg. I need it to be C:\Documents and Settings\My Documents\My Pictures\F0000040.jpg |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating a full path, need help with leading zero's
You need to do two things
1) You need to combine your strings with "&" 2) You can't store the number 0000040 into a variable declared as an integer, or variant, or no type (ie Dim X) which is a variant. An integer variable will remove the leading zeroes. The variable should be delcared as a string. "TUTU" wrote: I need to format a series of numbers that are of different lengths to have leading zeros to be 7 digits. I need these to be able to be merged with 2 other cells to create a field that is a path to photos, to use in a Publisher merge. So in cell A1, I have the first part of the path: C:\Documents and Settings\My Documents\My Pictures\F. In cell B2 I have the numbers (different numbers like 9, 40, 123, 4567, and 34567) that need to go after the path. Then I have in cell C2 I have .jpg. If I use format, custom, 0000000 it works until I merge the cells together. When they are merged I get C:\Documents and Settings\My Documents\My Pictures\F40.jpg. I need it to be C:\Documents and Settings\My Documents\My Pictures\F0000040.jpg |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating a full path, need help with leading zero's
Maybe...
=$a$1&text(b2,"0000000")&c2 TUTU wrote: I need to format a series of numbers that are of different lengths to have leading zeros to be 7 digits. I need these to be able to be merged with 2 other cells to create a field that is a path to photos, to use in a Publisher merge. So in cell A1, I have the first part of the path: C:\Documents and Settings\My Documents\My Pictures\F. In cell B2 I have the numbers (different numbers like 9, 40, 123, 4567, and 34567) that need to go after the path. Then I have in cell C2 I have .jpg. If I use format, custom, 0000000 it works until I merge the cells together. When they are merged I get C:\Documents and Settings\My Documents\My Pictures\F40.jpg. I need it to be C:\Documents and Settings\My Documents\My Pictures\F0000040.jpg -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating a full path, need help with leading zero's
Thank you Dave, that worked, and was so easy.
"TUTU" wrote: I need to format a series of numbers that are of different lengths to have leading zeros to be 7 digits. I need these to be able to be merged with 2 other cells to create a field that is a path to photos, to use in a Publisher merge. So in cell A1, I have the first part of the path: C:\Documents and Settings\My Documents\My Pictures\F. In cell B2 I have the numbers (different numbers like 9, 40, 123, 4567, and 34567) that need to go after the path. Then I have in cell C2 I have .jpg. If I use format, custom, 0000000 it works until I merge the cells together. When they are merged I get C:\Documents and Settings\My Documents\My Pictures\F40.jpg. I need it to be C:\Documents and Settings\My Documents\My Pictures\F0000040.jpg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem with leading zero's in creating a full path | Excel Discussion (Misc queries) | |||
Leading Zero's in Excel | Excel Discussion (Misc queries) | |||
Leading Zero's | Excel Discussion (Misc queries) | |||
How to add leading zero's | Excel Worksheet Functions | |||
Leading zero's | Excel Discussion (Misc queries) |