Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RE: How do I merge two cells without deleting data from the cell?

9,466 views
Skip to first unread message

Batmans_Wife

unread,
May 12, 2005, 5:05:02 PM5/12/05
to
Thank you so much for sending me this formula. It worked perfectly and did
exactly what I needed. I really appreciate your quick, helpful response.

Sincerely,
Michelle

"Peo Sjoblom" wrote:

> You can't, you can concatenate 2 cells into one by using a formula and
> ampersand
>
> =A1&" "&B1
>
>
> however stay away from merging cells, always cause more problems than what
> it's worth and layout wise you can get very close without using it. I have
> never seen a power user using merging
>
> Regards,
>
> Peo Sjoblom
>
> "Batmans_Wife" wrote:
>
> > I'm highlighting two cells in the same row, hitting format cells, alignment,
> > merge cells and I'm getting the error message, "The selection contains
> > multiple data values. Merging into one cell will keep the upper-left most
> > data only." I want to be able to make the two seperate cells one without
> > deleting anything and without having to cut and paste.

JE McGimpsey

unread,
May 12, 2005, 5:05:11 PM5/12/05
to
To concatenate in place, you can use a macro like the one found here:

http://www.mcgimpsey.com/excel/mergedata.html


In article <960DC31C-EDD3-4871...@microsoft.com>,

Batmans_Wife

unread,
May 12, 2005, 5:46:07 PM5/12/05
to
Thanks for sending the link to your page with the macros and instructions.
It's very detailed and thorough. Although I was able to figure it out with
the formula that Peo posted earlier, I appreciate your further information
and will keep it handy for future use.

Sincerely,
Michelle

xjaysfan

unread,
May 23, 2006, 7:14:01 AM5/23/06
to
Hi there
But I don't want formulas on the page..
As Well I am merging cell c and d and want the info to stay in d
I will end up copying and pasting to another program

Thanks
Sandra

Dave Peterson

unread,
May 23, 2006, 12:03:11 PM5/23/06
to
I think I'd insert a new column E and put the formula there.

You could copy that range to the other program.

Or you could convert that new column E to values and delete columns C:D (or just
column D???).

--

Dave Peterson

Angie

unread,
Apr 28, 2008, 12:52:01 PM4/28/08
to
The answer to my prayers! How do you convert the column into values?

Dave Peterson

unread,
Apr 28, 2008, 1:53:56 PM4/28/08
to
Select the range to convert to values
Edit|Copy
Edit|Paste special|Values

--

Dave Peterson

Gord Dibben

unread,
Apr 28, 2008, 7:48:46 PM4/28/08
to
See answer at your other post.


Gord

On Mon, 28 Apr 2008 05:52:01 -0700, Angie <An...@discussions.microsoft.com>
wrote:

roshni

unread,
May 2, 2008, 9:09:01 AM5/2/08
to

Thank you so much for sending me this formula.I really appreciate your
quick, helpful response.

Sincerely,
roshni

kimceee

unread,
May 21, 2008, 1:04:56 AM5/21/08
to
Dave, Thanks, just found your reply to the other poster -
I have been trying to do this for hours - I knew it had to be possible
thank you thank you

Dave Peterson

unread,
May 21, 2008, 2:03:22 AM5/21/08
to
Thank goodness for Google <vbg>!

--

Dave Peterson

anthony561fl

unread,
Aug 6, 2008, 1:46:01 PM8/6/08
to
This works great. However, what if Im wanting to combine several columns, say
50 or 100 columns worth of data? Id hate to have to enter each cell name in
that formula. Is there a way to specify a range of columns or cells rather
than each one before and after ampersands?

Gord Dibben

unread,
Aug 6, 2008, 8:58:49 PM8/6/08
to
Not without a User Defined Function like this one.

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
For Each Cell In CellBlock
If Len(Cell.text) > 0 Then sbuf = sbuf & Cell.text & " "
' for comma-delimited change above " " to ","
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

Usage is: =concatrange(A1:Z1)

Nore: blank cells will be ignored.

For similar methods with code see this search result from google

http://tinyurl.com/6ao6k4


Gord Dibben MS Excel MVP

anthony561fl

unread,
Aug 10, 2008, 3:49:00 PM8/10/08
to
Im still stuck on trying to concatenate a wide range of cells. I tried the
formula
=concatrange(K2:KZ2)
but get the following:
#NAME?

When I try to search help for concatrange, nothing comes up, only
concatenate.

Could you clarify more for me please? Thank you.

David Biddulph

unread,
Aug 10, 2008, 4:06:09 PM8/10/08
to
Concatrange was a user defined function which Gord included in his message.
You won't find it in help as it isn't a native Excel function.
Have you included that UDF?
--
David Biddulph

"anthony561fl" <anthon...@discussions.microsoft.com> wrote in message
news:C511EEEC-CD18-498A...@microsoft.com...

Gord Dibben

unread,
Aug 10, 2008, 4:58:03 PM8/10/08
to
You cannot concatenate a range of cells using the Excel CONCATENATE
function.

Either =CONCATENATE(K2,L2,M2) etc. or =K2&L2&M2 etc.

or a User Defined Function

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
For Each Cell In CellBlock
If Len(Cell.text) > 0 Then sbuf = sbuf & Cell.text & " "

' the " " returns space-delimited text


Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

Usage is: =ConCatRange(K2:KZ2)

If you're not familiar with VBA and macros/functions, see David McRitchie's
site for more on "getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

or Ron de De Bruin's site on where to store macros.

http://www.rondebruin.nl/code.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + r to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

In a cell enter the formula as shown above in Usage is:


Gord Dibben MS Excel MVP

Geejeta

unread,
Sep 17, 2008, 7:44:01 PM9/17/08
to
I am trying to do the same thing; merge cells without deleting the data but
when i enter the formula below, a "0" appears. What am I missing?


"Peo Sjoblom" wrote:

> You can't, you can concatenate 2 cells into one by using a formula and
> ampersand
>
> =A1&" "&B1
>
>
> however stay away from merging cells, always cause more problems than what
> it's worth and layout wise you can get very close without using it. I have
> never seen a power user using merging
>
> Regards,
>
> Peo Sjoblom
>

Gord Dibben

unread,
Sep 17, 2008, 11:40:23 PM9/17/08
to
What do you have in A1 and B1?


Gord Dibben MS Excel MVP

rapid1

unread,
Nov 5, 2008, 2:22:00 PM11/5/08
to
Works perfectly Gord - and please excuse my noobness, but how do I make the
function available to all spreadsheets that I open without have to recreate
the function each time?

Ray D

Gord Dibben

unread,
Nov 5, 2008, 5:19:38 PM11/5/08
to
You can copy the UDF into a general module in your Personal.xls which will
make it available for all open workbooks.

You could copy/paste it into a general module in a new workbook, save that
workbook as an Add-in which you would load through Tools>Add-ins.

I prefer the Add-in method so's I don't have to preface the Function with
the workbook name.

i.e. if saved in Personal.xls you must enter

=Personal.xls!ConCatRange(range)

If stored in the add-in =ConCatRange(range) is sufficient.


Gord

On Wed, 5 Nov 2008 06:22:00 -0800, rapid1 <rap...@discussions.microsoft.com>
wrote:

Oli

unread,
Nov 7, 2008, 10:42:00 AM11/7/08
to
Hi,
I want to merge two columns...not two cells only...i have values in column B
and C and I like to merge them together in one go...the number of values I
got in the columns are more than 19,000 (i.e. I have 19000 rows of data)

Can anyone help plz?

Thanks in advance
Oli

Gord Dibben

unread,
Nov 7, 2008, 8:28:15 PM11/7/08
to
Enter the formula provided by Peo into C1 then double-click on the fill
handle of C1 to copy to end of data in column B

BTW.............this operation would not be "merging" the columns, it would
be "combining" them.


Gord Dibben MS Excel MVP


On Fri, 7 Nov 2008 02:42:00 -0800, Oli <O...@discussions.microsoft.com>
wrote:

j9

unread,
Dec 13, 2008, 2:04:01 AM12/13/08
to
Thanks that was helpful, but how do you continue the formula for a lot of
rows. It keeps repeating the 1st one down.

Thank you!

j9

unread,
Dec 13, 2008, 2:09:00 AM12/13/08
to
is it the same formula for all the rows...it keeps repeating the same thing
all the way down...an ideas?

j9

unread,
Dec 13, 2008, 2:15:02 AM12/13/08
to
what if you wanted to do multiple rows?

Gord Dibben

unread,
Dec 13, 2008, 4:59:18 PM12/13/08
to
Browse through these postings to which you tacked onto.

http://tinyurl.com/599r3q

Make sure that your calculation mode is set to automatic so's you don't get
same results all the way down.


Gord Dibben MS Excel MVP

AcousticVin

unread,
Jan 7, 2009, 5:15:01 PM1/7/09
to
The formula worked perfectly for me as well...thanks for the post.

MK

unread,
Jan 15, 2009, 8:09:01 PM1/15/09
to

try instead of a1&" "$b1":
$A1&" "&$B1
then drag/fill the cell however many rows/cols you want to do

the "$" makes it absolute and fill wont change the valu immediatly preceded
by the "$" so "A" and "B" will never change but "1" in both cases will

MK

unread,
Jan 29, 2009, 6:50:01 PM1/29/09
to
Thankyou Gord I tried to write this code my self and failed your sorce code
is what i needed to get started I wish Microsoft wold make this a standard in
thier formulas as I find it very useful I still need to modify it slightly to
work with more applications but at least I have the start I needed and have
you to thank for that

Gord Dibben

unread,
Jan 29, 2009, 10:50:56 PM1/29/09
to
Thanks

Good luck on the rest.

Jim (mcse03@myway.com)

unread,
Feb 4, 2009, 12:03:01 AM2/4/09
to
Thank you Peo!

That's a great formula!

-Jim

KHaberwoman

unread,
Aug 28, 2009, 8:43:01 PM8/28/09
to
I am trying to merge 3 columns into one to put on a mailing label. I am
trying to concantinate and my formula is =("A2,&B2" ",&C2")

Only the Middle field does not already have an empty character at the end of
the cell so they don't need a blank space in between. I want my results to
be: To the ________ Family

Problem: I haven't tried this since upgrading to Office 2007 and I get the
formula in the cell but not the results? What am I doing wrong?

Thanks

bonnie

unread,
Nov 12, 2009, 3:42:01 PM11/12/09
to
How do you merge two calls when one row contains the same information and the
second row contains different information

David Biddulph

unread,
Nov 12, 2009, 3:57:06 PM11/12/09
to
Please read again what Peo told you.
--
David Biddulph

"bonnie" <bon...@discussions.microsoft.com> wrote in message
news:CC86DE1A-2A1B-4D68...@microsoft.com...

GetWet

unread,
Dec 2, 2009, 6:17:01 PM12/2/09
to
I'm new to this... where do I place the formula?
Thanks,

Dave Peterson

unread,
Dec 2, 2009, 8:15:07 PM12/2/09
to
Any cell that you want--except for A1 and B1.

I like to insert a new helper column (Maybe column C in this case, so it's close
to the data), then use the cells in that new column.

--

Dave Peterson

Wahaj Ul Hasan@discussions.microsoft.com Syed Wahaj Ul Hasan

unread,
Mar 7, 2010, 3:52:01 PM3/7/10
to
wow! many thanks... it worked perfectly fine and solved my problem. Best
Regards, Wahaj

Joe

unread,
Apr 3, 2010, 6:19:01 PM4/3/10
to
Are there any characters that can be added between the &" and the "& so that
the combined cells can appear as a list instead of a line? For instance, I
have two sentences in two different cells. I want to put in one cell, but
have one above the other with spacing in between.

"Peo Sjoblom" wrote:

> You can't, you can concatenate 2 cells into one by using a formula and
> ampersand
>
> =A1&" "&B1
>
>
> however stay away from merging cells, always cause more problems than what
> it's worth and layout wise you can get very close without using it. I have
> never seen a power user using merging
>
> Regards,
>
> Peo Sjoblom
>

Paul

unread,
Apr 3, 2010, 7:59:01 PM4/3/10
to

You can use:

=A1&CHAR(10)&B1

Be sure to format the cell as having wrapped text, otherwise you'll
just see a small symbol between the values from A1 and B1.


--
Paul

- Paul
------------------------------------------------------------------------
Paul's Profile: 1697
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=192711

http://www.thecodecage.com/forumz

Stephie

unread,
May 10, 2010, 4:58:01 PM5/10/10
to
This worked perfectly, however, I now need to put a comma between the two
names - i.e. currently I have Smith John in one cell, and need Smith, John in
one cell. Is there a way to do that?

Don Guillett

unread,
May 10, 2010, 5:52:48 PM5/10/10
to
When all else fails, think about it....

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dgui...@gmail.com
"Stephie" <Ste...@discussions.microsoft.com> wrote in message
news:AA47D297-9932-4280...@microsoft.com...

Dave Peterson

unread,
May 10, 2010, 6:02:18 PM5/10/10
to
As long as your original data is still there, you can use another formula:

=A1&", "&B1

If all you have is the cell with the result, you could use:

=substitute(a1," ",", ")

Stephie wrote:

--

Dave Peterson

Jess12

unread,
May 27, 2010, 8:46:14 PM5/27/10
to
That works except now i have a lot of spaces between the information. How
would you get rid of those spaces

Bob I

unread,
Jun 1, 2010, 6:02:32 PM6/1/10
to
Then use this instead.

=A1&B1

GonzaloRC

unread,
Jun 2, 2010, 6:15:12 PM6/2/10
to
Hi Gord,
Is there a way I can specify so that the function will:
a) change the results from target cell to next door neighboring cell as values
b) Separate out each string as a line within the same cell, as if I had used
the alt+Enter option myself?

Thanks,

Gord Dibben

unread,
Jun 2, 2010, 6:30:09 PM6/2/10
to
2. Change the de-limiter from " " or "," to Chr(10) and set the cell to
wrap text.

If Len(Cell.Text) > 0 Then sbuf = sbuf & Cell.Text & Chr(10)

1. The function cannot copy anything to anywhere.

Functions return results to the cell in which they are written.

You can manually Copy and paste special>values to next door cell.


Gord

GonzaloRC

unread,
Jun 2, 2010, 7:19:34 PM6/2/10
to
Thanks Gord...

"Gord Dibben" wrote:

> .
>

gns...@gmail.com

unread,
Feb 12, 2020, 6:26:15 AM2/12/20
to
I'm not sure what I'm doing wrong. I highlight the two cell, ctr C, move to a cell to the right, Edit|Paste Special|Value only, and both cells are copied to the two cells where I move my focus. It just duplicates the two cells. It doesn't combine the contents into the one new cell

Hmmm,
0 new messages