[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Text with trailing spaces

Posted on 2012-04-03
7
Medium Priority
?
279 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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 demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

656 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