Filling in cells with zero's

alexv

New Member
Joined
Jun 26, 2006
Messages
27
I need to create an excel file that I will save as a text file. The problem I am having is filling in cells with zero's when the cell value should be a certain number of characters long and the text value can vary. When I save the file as a text file, I don't want to lose the zero's. Help!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Use the custom format and make the format 000000000 or however many digits you need.

5555 becomes 000005555
 
Upvote 0
There is one more issue. If I need to join two cells, each with their own defined number of characters, I will lose the zero's when I join the two items.
 
Upvote 0
=TEXT(A1,"0000000000") will create a text string with the zeroes attached....then you can concatenate the strings without losing the zeroes.
 
Upvote 0
Great, I think that's what I need. One other item I need for this file...I have a currency amount in a cell, and need to present that amount in a different cell without the decimals. ex, 1225.41 should be listed as 122541.
 
Upvote 0
Fabulous, didn't think of that.
One last thing, I would like to apply the cell value length to a cell containing text. Example, my cell says ABC Co. and I need the cell value to be 20 characters long, with any non text characters up to 20 filled in as blanks. So the cell should read ABC Co.(7 characters and 13 blanks next to it) so that if I do LEN formula on it, I will get 20, instead of 7. I hope this makes sense.
 
Upvote 0
Maybe:

=A1&REPT(" ",20-LEN(A1)) where A1 house the original string.
 
Upvote 0
Try

=LEFT(A1&REPT(" ",20),20)

which wil increase 7 characters to 20 (with added spaces) or reduce +20 characters to 20
 
Upvote 0

Forum statistics

Threads
1,222,246
Messages
6,164,805
Members
451,917
Latest member
WEB78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top