Hi there:
I am working on an excel file that I will later need to concatenate and save into a text file. As part of this, I need to get one column to have 30 character spaces in it, even if I have less than 30 characters of data in the cell. Anyone know how I can do that?
Use a Helper column with this formula
=LEFT(A1&REPT(" ",30),30)
Which means take A1 add 30 spaces to it, take the first 30 characters so the result will always have 30 characters
Regards
Special-K
I rarely return to a problem once I've answered it so make sure you clearly define what the trouble is.
Hi Scottrontondo,
Welcome to the forum.
If you need 30 spaces in the cell not matter if the cell has something or not, use following formula:-
If you want all the characters of the cell and deficiency to make 30 chars to be filled by spaces, use following formula:-=B1&REPT(" ",30)
If you want just 30 characters only where deficit will be filled by zeros, use following formula:-=B1&REPT(" ",IF(LEN(B1)>30,0,30-LEN(B1)))
All above example assumes you want to append (padd) zeros on the right side of the text.=IF(LEN(B1)<=30,B1&REPT(" ",30-LEN(B1)),LEFT(B1,30))
If you still have issues, post your sample file with little explanation. Thanks.
Regards,
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
actually, I just need blank spaces on the right side of the text, to get to 30 character spaces total for the cell. So, if there's 15 characters of data, I will need 15 blank spaces after that, to get to 30.
Scott,
Special-K's formula from above should work in your case. Just be sure to modify the formula correctly to suit. Did you correct the cell reference ( the A1 in his formula should match the cell you are trying to manipulate.
Hello Scott,
Just a small change in Special-K's formula, use like
=A1&REPT(" ",30-LEN(A1))
Change reference accordingly.
HTH; Haseeb
If your problem is solved, please say so clearly, and mark your thread as Solved:
Forum Rules & How to Mark a thread as SOLVED
thanks! think I am all set now. Thank you all!!!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks