Hi,
I have two columns of data. First is an account code with 22,268 rows. Second is a string of numbers which I need to "append" to the account codes. Problem is, the second field has only eight rows. So I need to have the account code in col 1 row 1 concatenate with each of the entries in col 2... then have the account code in col 1 row 2 concatenate with each of the entries in col 2... etc.
In the samples below, Account code is in col A... String(s) to be added are in col B. Then in col C I need for each code in col A to be joined with all of the strings in col B.
Account Code String(s) to be added to each Account Code
001-001001-001234- 401260 Benefits Retirement 1 2
001-001001-002345- 401270 Benefits Retirement 1 2
001-001001-003456- 401280 Benefits Retirement 1 2
001-001001-004567- 750400 Benefits Retirement 1 2
001-001001-005678- 410000 Benefits Retirement 1 2
001-001001-006789- 420000 Benefits Retirement 1 2
002-002001-001234- 430000 Benefits Retirement 1 2
002-002001-002345- 440000 Benefits Retirement 1 2
002-002001-003456- 450000 Benefits Retirement 1 2
002-002001-004567- 460000 Benefits Retirement 1 2
002-002001-005678-
002-002001-006543-
002-002001-006432-
002-002001-006321-
002-002001-005432-
So I would like to end up with this result:
001-001001-001234-401260
001-001001-001234-401270
001-001001-001234-401280
001-001001-001234-750400
001-001001-001234-410000 ... and on and on until each account code in col A has been combined with every string in col B. Does that make sense?
Peter was kind enough to send code that does the job as I originally needed. Now they tell me that I need to add description(s) to this project... to make the result look like this:
001-001001-001234-401260 Benefits Retirement 1 2
001-001001-001234-401270 Benefits Retirement 1 2
and so on. So it is really an expansion of Peter's code (copied below) that I need now to emcompass these extra fields/columns that must be a part of my results.
Here is the code that Peter generated previously:
Sub concat()
Dim LR As Long, i As Long, j As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
For j = 1 To 8
Range("C" & Rows.Count).End(xlUp).Offset(1).Value = Range("A" & i).Value & Range("B" & j).Value
Next j
Next i
End Sub
I wish I were smart enough to do this myself... but I'm not. Thanks for your help.
Ken
I have two columns of data. First is an account code with 22,268 rows. Second is a string of numbers which I need to "append" to the account codes. Problem is, the second field has only eight rows. So I need to have the account code in col 1 row 1 concatenate with each of the entries in col 2... then have the account code in col 1 row 2 concatenate with each of the entries in col 2... etc.
In the samples below, Account code is in col A... String(s) to be added are in col B. Then in col C I need for each code in col A to be joined with all of the strings in col B.
Account Code String(s) to be added to each Account Code
001-001001-001234- 401260 Benefits Retirement 1 2
001-001001-002345- 401270 Benefits Retirement 1 2
001-001001-003456- 401280 Benefits Retirement 1 2
001-001001-004567- 750400 Benefits Retirement 1 2
001-001001-005678- 410000 Benefits Retirement 1 2
001-001001-006789- 420000 Benefits Retirement 1 2
002-002001-001234- 430000 Benefits Retirement 1 2
002-002001-002345- 440000 Benefits Retirement 1 2
002-002001-003456- 450000 Benefits Retirement 1 2
002-002001-004567- 460000 Benefits Retirement 1 2
002-002001-005678-
002-002001-006543-
002-002001-006432-
002-002001-006321-
002-002001-005432-
So I would like to end up with this result:
001-001001-001234-401260
001-001001-001234-401270
001-001001-001234-401280
001-001001-001234-750400
001-001001-001234-410000 ... and on and on until each account code in col A has been combined with every string in col B. Does that make sense?
Peter was kind enough to send code that does the job as I originally needed. Now they tell me that I need to add description(s) to this project... to make the result look like this:
001-001001-001234-401260 Benefits Retirement 1 2
001-001001-001234-401270 Benefits Retirement 1 2
and so on. So it is really an expansion of Peter's code (copied below) that I need now to emcompass these extra fields/columns that must be a part of my results.
Here is the code that Peter generated previously:
Sub concat()
Dim LR As Long, i As Long, j As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
For j = 1 To 8
Range("C" & Rows.Count).End(xlUp).Offset(1).Value = Range("A" & i).Value & Range("B" & j).Value
Next j
Next i
End Sub
I wish I were smart enough to do this myself... but I'm not. Thanks for your help.
Ken