?
Solved

Text with trailing spaces

Posted on 2012-04-03
7
Medium Priority
?
278 Views
Last Modified: 2012-04-20
I need formula to convert text in cell to 10 characters in length inside quotes.


value in A1 B1000 to "B1000     "
0
Comment
Question by:cebu1014
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Accepted Solution

by:
ZShaver earned 1000 total points
ID: 37803648
you can set B1 to:
=A1&REPT(" ",10-LEN(A1))

and B1 will have the padded value

however you cannot place the formula in A1 because that cell contains the data and this would create a circular reference
0
 
LVL 7

Expert Comment

by:ZShaver
ID: 37803686
why would you want to do this anyways, doesn't make a lot of sense, maybe if you give us an explanation of the problem we can come up with better solution.
0
 

Author Comment

by:cebu1014
ID: 37803704
The result will be copied to text file for importing into program.
Can I  get the display to show "B1000    " in excel?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 42

Expert Comment

by:dlmille
ID: 37803713
Not for points:

In case cell A1 has trailing spaces in it, already, I would recommend a slight modification to ZShaver's tip:

[B1]=TRIM(A1)&REPT(" ",10-LEN(TRIM(A1)))

and copy down.  You can then copy B column and paste value to A column



Cheers,

Dave
0
 
LVL 7

Expert Comment

by:ZShaver
ID: 37803850
Can I  get the display to show "B1000    " in excel?
well, you can't see spaces, but if u underline the cell you can see it is working
0
 
LVL 8

Expert Comment

by:wchh
ID: 37804480
If you have mutiple columns,
You may adjust the column width, for example 10.
Save as "*.prn" file.
The column will be displayed as 10 characters include spacing.
0
 
LVL 14

Assisted Solution

by:Otto_N
Otto_N earned 1000 total points
ID: 37806103
I might be missing the point, but it seems that you want to include the double-quotes in the display?  Then just concatenate "CHAR(34)" before and after ZShaver or dlmille's suggestion, i.e
B1=CHAR(34) & A1&REPT(" ",10-LEN(A1)) & CHAR(34)
  or
B1=CHAR(34) & TRIM(A1)&REPT(" ",10-LEN(TRIM(A1))) & CHAR(34)

This will return the text string including quotes.  Just note that, if the input text string is longer than 10 characters, you will receive a "#VALUE"-error.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently attended Cisco Live! in Las Vegas, a conference that boasted over 28,000 techies in attendance, and a week of hands-on learning hosted by a solid partner with which Concerto goes to market.  Every year, Cisco displays cutting-edge technol…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question