ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Merging three cells into one (https://www.excelbanter.com/excel-discussion-misc-queries/196291-merging-three-cells-into-one.html)

Randi

Merging three cells into one
 
I have four cells I want to merge into one cell.
I have used the "=A1 & " " & B1 & " " & C1 & " " & D1
to combine them into one cell - but what do I use to tell it
to not put a space if there is no middle initial or no suffix? Thanks

A1 A2 A3 A4
John D. Ameen
Kenneth E. Amos Jr.
Brett Anderson
Gregory T. Anderson


John C[_2_]

Merging three cells into one
 
=A1&IF(B1="",""," "&B1)&C1&IF(D1="",""," "&D1)

Hope this helps.
--
John C


"Randi" wrote:

I have four cells I want to merge into one cell.
I have used the "=A1 & " " & B1 & " " & C1 & " " & D1
to combine them into one cell - but what do I use to tell it
to not put a space if there is no middle initial or no suffix? Thanks

A1 A2 A3 A4
John D. Ameen
Kenneth E. Amos Jr.
Brett Anderson
Gregory T. Anderson


John C[_2_]

Merging three cells into one
 
or, if you like....
=TRIM(A1&" "&B1&" "&C1&" "&D1)
--
John C


"Randi" wrote:

I have four cells I want to merge into one cell.
I have used the "=A1 & " " & B1 & " " & C1 & " " & D1
to combine them into one cell - but what do I use to tell it
to not put a space if there is no middle initial or no suffix? Thanks

A1 A2 A3 A4
John D. Ameen
Kenneth E. Amos Jr.
Brett Anderson
Gregory T. Anderson


John C[_2_]

Merging three cells into one
 
Actually, this one should have been:
=A1&IF(B1="",""," "&B1)&" "&C1&IF(D1="",""," "&D1)
--
John C


"John C" wrote:

=A1&IF(B1="",""," "&B1)&C1&IF(D1="",""," "&D1)

Hope this helps.
--
John C


"Randi" wrote:

I have four cells I want to merge into one cell.
I have used the "=A1 & " " & B1 & " " & C1 & " " & D1
to combine them into one cell - but what do I use to tell it
to not put a space if there is no middle initial or no suffix? Thanks

A1 A2 A3 A4
John D. Ameen
Kenneth E. Amos Jr.
Brett Anderson
Gregory T. Anderson



All times are GMT +1. The time now is 02:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com