Combining every 4 cells into 1 without losing data

charlie3113

New Member
Joined
Apr 12, 2017
Messages
2
Hello,

I have a column with hundreds of cells, and I want to combine every four cells into a single cell, without losing data. Also, there should be a space between each string that is combined. So:

Hi
there
how
ru
I
am
OK
thanks
That
is
great
bye


I want to combine so that I get three cells that read:

Hi there how ru
I am OK thanks
That is great bye


And on and on until all of the hundreds of cells in the column have been so combined. So if I have 1,000 cells, I should end up with 250 combined cells. Any help is greatly appreciated! Thank you!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You can add cell contents simply by & formula, so if "Hi" is A1, "there" is A2 and so on, you need only another cell with formula:
=A1&" "&A2&" "&A3&" "&A4
then copy formula down every 4th cell (let me know if you need help with doing that)
 
Upvote 0
Thank you for the reply, but I'm wondering if there is a way to do this with a macro. My project is rather complicated, and I will need to do this same merge process more than 100 times in separate spreadsheets. So that's a lot of copying and pasting. If I could just run a macro on each sheet, it would save a ton of time. Thanks!
 
Upvote 0
Try this one:
Code:
Sub merger()
Dim lastrow As Long
Cells(1, 2).FormulaR1C1 = "=RC[-1]&"" ""&R[1]C[-1]&"" ""&R[2]C[-1]&"" ""&R[3]C[-1]"
lastrow = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
For Row = 1 To lastrow Step 4
    Cells(1, 2).Copy Cells(Row + 4, 2)
Next Row
End Sub
Of course it assumes where specific cells are:
- your text is in column 1 row after row,
- there is 2nd column empty for merged values
You'd have to amend values if your data is elsewhere.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top