Combine Multiple Cell Ranges based on adjacent Cell Values

Status
Not open for further replies.

chaitu585

New Member
Joined
Feb 19, 2018
Messages
3
I've a range of text with details such as Name, Email ID, Telephone and Address.

fMhg86Y.png


I want the all the address lines to be combined into once cell separated by line breaks as given below

xrt5Qt6.png


I've been using "kutools for excel" combine rows option for these kind of functionality and it is okay for one or two entries. However, here I have hundreds of these address bars and I'd really appreacite if some one could put together a VBA code for this (I've no idea how to write one).

As far as i think, ideal logic to run a loop would be; based on the cell values in column one,

if a cell is filled combine all rows below that (until you can find another filled cell in the column) to the top row. i.e

A1 is filled. Next Filled is A2. so leave row 1.
A2 is filled. Next Filled is A4. So combine rows 2 and 3.
A4 is filled. Next Filled is A6. So combine rows 4 and 5.
A6 is filled. Next filled is A10. So combine rows 6,7,8 and 9.
A10 is filled. Next Filled is A11. so leave row 10
.
.
.
and so on. We can run this loop till a certain row number.

If someone could put this logic into a code, i would be much obliged.

Thanks in Advance.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Status
Not open for further replies.

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