Three Bags Full, Sir/Madam

From time to time, I am asked to do things that make no sense to me (but I know we are all different). One such request was to concatenate the contents of three columns in Excel into a single column, but with fixed width for the results, as below (copied from a single column in Excel):

table1.jpg

I don’t know why three columns, looking almost identical, were not good enough:

table2.jpg

I suppose it was a question of style. However, it was a case of “You heard the (wo)man”. To right-pad one cell, use =$A1&REPT(“ “,PadColWidht-LEN($A1)) – PadColWidth is a Named Constant with a value of 20, in Name Manager:

excel-clip.jpg

So, this is the formula in full (for all three columns):

=$A1&REPT(” “,PadColWidth-LEN($A1))&$B1&REPT(” “,PadColWidth-LEN($B1))&TEXT($C1,”yyyy-mmm-dd”)

At the very least, it is a reasonable example of how to pad strings. A typical use case for this is for making last minute changes to a document linked to a spreadsheet. Once the table is copied from Excel to Word, using the option Link and Keep Source Formatting, any changes made to the Excel worksheet in future will immediately update next time the Word document is opened.

 
0
Kudos
 
0
Kudos

Now read this

Excel 2013: three new functions

DAYS() Date arithmetic is nothing new in Excel, but this function is new to Excel 2013. Previously one had to use a formula like “=B1-A1” where B1 would contain the later date, A1 the earlier date. Typing “=DAYS(“ in a cell, you are... Continue →