Way to have a formula that combines the text of two different cell

  • Thread starter Thread starter ghu
  • Start date Start date
G

ghu

Any way to have a formula that combines the text of two different cells into
a third cell?

For example:
A1= Hello
A2 =Goodbye
For so that
A3 = Hello Goodbye


Thanks
 
ghu said:
Any way to have a formula that combines the text of two different
cells into a third cell?
For example:
A1= Hello
A2 =Goodbye
For so that
A3 = Hello Goodbye

In A3:

=A1 & " " & A2
 
Max said:
Might as well take the opportunity to "clean up" the source cells' input
as well, so I'd wrap TRIM around the concat: =TRIM(A1&" "&A2)

Although I think you are "killing an ant with a sledgehammer", your formula
only trims leading blanks from A1 and trailing blanks from A2. I believe
the correct formula to do what you want is:

=TRIM(A1) & " " & TRIM(A2)


----- original message -----
 
Actually, =trim() removes any duplicated space characters within the
string--even if that string is the result of that concatenation operation.
 
Dave Peterson said:
Actually, =trim() removes any duplicated space characters
within the string

Aha! You are right. RTFM: TRIM "[r]emoves all spaces from text except for
single spaces between words". Mea culpa!

Fortunately, the OP did not want two or more spaces between the concatenated
cells ;-).


----- original message -----
 
Maybe you were thinking of VBA's Trim() function. That one doesn't touch the
internal spaces.
Dave Peterson said:
Actually, =trim() removes any duplicated space characters
within the string

Aha! You are right. RTFM: TRIM "[r]emoves all spaces from text except for
single spaces between words". Mea culpa!

Fortunately, the OP did not want two or more spaces between the concatenated
cells ;-).

----- original message -----

Dave Peterson said:
Actually, =trim() removes any duplicated space characters within the
string--even if that string is the result of that concatenation operation.
 
Back
Top