How to concatenate using another column as a reference

notaguru1

New Member
Joined
Jun 9, 2015
Messages
12
Hi,

I have the following workseet as an example:

A12345
2
3
4
5
A6789
7
8
9
A1011
11

<TBODY>
</TBODY>

Looking at column A, I want to concatenate values in column B starting in row 2 up until the next row where there is a value in column A.

So I imagine the formula would look something like this for the first value returned: =IF(A1="","",B2&B3&B4&B5) this would return 2345

But I dont know how to create this formula where it will be true for the entire sheet. My sheet has over 1000 rows of data.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I can't offer a formula, but here's a macro that will do what you want. Assumes a layout identical to your example.

Code:
Sub Notaguru()
Dim Ar As Range, c As Range, V As Variant
Application.ScreenUpdating = False
For Each Ar In Columns("A").SpecialCells(xlBlanks).Areas
          For Each c In Ar.Cells
                    V = V & c.Offset(0, 1).Value
          Next c
          Ar(1).Offset(-1, 2).Value = V
          V = ""
Next Ar
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,207,089
Messages
6,076,517
Members
446,211
Latest member
b306750

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