• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Build a tabbed text cell with Concatenate

fred3

Member
I'm trying to Concatenate two cells into one where I need the rightmost entry to be aligned on its left end with all others so generated.
The first component from Column A isn't of equal length from row to row. Nor, is the second component from Column B.
Like this:
A B C
_______ _____ ______________
abc 12 abc 12
defghgh 456 defghgh 456
It seems like TAB would be the thing to use if possible like this:
=Concatenate(A1,|TAB??|,B1)

How can I do this?
 
TAB or CHAR(9) cannot be displayed within Excel Cell.

If you use =CONCATENATE(A1,CHAR(9),B1)
You will see AB in cell.

However, if you copy the cell value and paste it into text editor, you will see that tab (CHAR(9)) is present.

Meaning it's just display limitation on Excel cell.

What is the maximum length of A and B respectively? If you know the absolute maximum length of A+B. Then you can use REPT("",#) to adjust character positions.
 
If you use the formula from Chihiro & then format the column C as Horizontal Alignment = "Distributed (Indent)" you should get what you want.
 
Took me a while to remember how to do it, but comes in handy occasionally
As it happens it also works with a space rather than a "Tab"
=CONCATENATE(A1," ",B1)
 
@fred3
Since you appear to like Courier New!
I named the text to be concatenated 'Parts' as a row-relative reference
(for data, I used four parts of a person's name).

My formula was
= CONCAT( REPLACE( blank, 1, LEN(Parts), Parts ) )
where the 'blank's were defined by a named formula to be
= REPT(" ", tab)
and 'tab' was an array of character lengths that gave suitable spacing for the output, e.g.
= MAX(LEN(First)) + 2

60347
 
Last edited:
Back
Top