Merging Cells between two specific cells

baha17

Board Regular
Joined
May 12, 2010
Messages
183
Hi Everyone,

I cannot upload my worksheet because of restrictions of my company. I have a worksheet whiuch is exported by another database software. As the file exported the worksheet formatted as below format:

AxxxxxxxxxxxxxxBxxxxxxC
1 TablexxxxxxxxSKxxxxxdetails
2 -------xxxxxxx---xxxx-------
3 ACB554xxxxxxxxxxxxxxsome data
4 xxxxxxxxxxxxxxxxxxxxxsome data
5 xxxxxxxxxxxxxxxxxxxxxsome data
6 xxxxxxxxxxxxxxxxxxxxxsome data
7 -------xxxxxxx---xxxx---------

PLEASE CONSIDER "x" AS SPACE

As you can see above; there are some space between row number 3 and 7. However that is not fixed space, I mean somewhere in the same column there are four or five rows(in column A) blank, that is because of the details in column C. This exported data is very long, can say like 50,000 rows. Here is my problem:
I would like to merge the all cell between "-----" lines. But I am not sure how to do and secondly how to manage to do it on coulumn C same look but in one cell.
Thank you in advance if you can provide me any help.
Baha
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi Everyone,

I cannot upload my worksheet because of restrictions of my company. I have a worksheet whiuch is exported by another database software. As the file exported the worksheet formatted as below format:

AxxxxxxxxxxxxxxBxxxxxxC
1 TablexxxxxxxxSKxxxxxdetails
2 -------xxxxxxx---xxxx-------
3 ACB554xxxxxxxxxxxxxxsome data
4 xxxxxxxxxxxxxxxxxxxxxsome data
5 xxxxxxxxxxxxxxxxxxxxxsome data
6 xxxxxxxxxxxxxxxxxxxxxsome data
7 -------xxxxxxx---xxxx---------

PLEASE CONSIDER "x" AS SPACE

As you can see above; there are some space between row number 3 and 7. However that is not fixed space, I mean somewhere in the same column there are four or five rows(in column A) blank, that is because of the details in column C. This exported data is very long, can say like 50,000 rows. Here is my problem:
I would like to merge the all cell between "-----" lines. But I am not sure how to do and secondly how to manage to do it on coulumn C same look but in one cell.
Thank you in advance if you can provide me any help.
Baha

Give ago with this:
Add this UDF to your workbook:
XL-CENTRAL.COM : VBA : Concatenate the Data in a Range
The use:

Excel 2010
ABCDE
1TableSkDetails
2-----xxx------
3ABC112345
42
53
64
75
8-----xxx------
9bbbb2245532124
104
115
125
133
142
151
162
174
18-----xxx------
Sheet1
Cell Formulas
RangeFormula
E3{=IF(AND(LEFT(A3,1)<>"-",A3<>""),SUBSTITUTE(AConcat(IF(OFFSET(C3,0,0,MATCH(TRUE,INDEX(B3:B500="xxx",0),0)-1,)<>"",""&OFFSET(C3,0,0,MATCH(TRUE,INDEX(B3:B500="xxx",0),0)-1,),"")),",","",1),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi Robert,
Thank you for your reply.I am sorry to mislead you but there is no "x",that one is only for space and 1,2,3,4... represents row numbers.So literally range("A2") :----- ; Range("A3"):"dats" and range("A4:A6"):"" then Range("A7"):------ I want to merge the cells between ------ lines.
Again thank you very much for the help
Bahs
 
Upvote 0
Hi Robert,
Thank you for your reply.I am sorry to mislead you but there is no "x",that one is only for space and 1,2,3,4... represents row numbers.So literally range("A2") :----- ; Range("A3"):"dats" and range("A4:A6"):"" then Range("A7"):------ I want to merge the cells between ------ lines.
Again thank you very much for the help
Bahs

From the Example I have posted what will be your final answer?
ABCbbb or as posted or all data 12345245532124.
My number values represent actuall values not row numbers.
Sorry if that confused you.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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