Automatically select ranges and apply Concatenate Unique

Peter Mooney

New Member
Joined
Jul 29, 2017
Messages
6
I have a table of 100,000 plus rows containing finance related data in which I would like to concatenate all the AccountTypes associated with a specific Journal Entry Identifier (JEIdentifier). Column 1 gives the JEIdentifier, Column 2 the AccountTypes, Column3 shows the AccountTypes prefixed with "c" for Credit and "d" for debit. I have found a function on this forum which allows you to specify manually a specific range of data to evaluate a set of records but what I would really like is code that will loop through the JEIdentifier Column and for each JEIndentifier return the associated AccountTypes. I imagine the records could be sorted by JEIdentifier so the code can work through sequential blocks of rows instead of having to read the entire ordered data set of 100,000 rows.

JEIdentifierAccountTypeAccountType2
1000101994Liabilities c|Liabilities c|Liabilities, d|Liabilities, c|Assets, d|Assets
1000101994Liabilities d|Liabilities
1000102019Assets c|Assets
1000102019Assets d|Assets
1000102154Liabilities c|Liabilities
1000102154Liabilities d|Liabilities
1000102155Liabilities c|Liabilities
1000102155Liabilities d|Liabilities
1000102156Liabilities c|Liabilities
1000102156Liabilities d|Liabilities
1000102157Liabilities d|Liabilities
1000102157Liabilities c|Liabilities
1000102158Liabilities c|Liabilities
1000102158Liabilities d|Liabilities
1000102159Liabilities c|Liabilities
1000102159Liabilities d|Liabilities
1000102160Liabilities c|Liabilities
1000102160Liabilities d|Liabilities
1000102160Liabilities d|Liabilities
1000102163Liabilities c|Liabilities
1000102163Liabilities d|Liabilities
1000102163Liabilities d|Liabilities
1000102225Assets c|Assets
1000102225Assets d|Assets

<colgroup><col width="92" style="width:69pt"> <col width="111" style="width:83pt"> <col width="140" style="width:105pt"> <col width="316" style="width:237pt"> </colgroup><tbody>
</tbody>


Function ConcatUniq(xRG As Range, XChar As String) As String
'updateby Extendoffice 20151228
Dim xCell As Range
Dim xDic As Object
Set xDic = CreateObject("Scripting.Dictionary")
For Each xCell In xRG
xDic(xCell.Value) = Empty
Next
ConcatUniq = Join$(xDic.Keys, XChar)
Set xDic = Nothing
End Function
 
Hi helpexce, I tried this formula in cell D2 where it returned a value of 1 in D2 and displayed the formula in cell E2. Please see Akuini's solutions version b and d. Thanks
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi Akuini, many thanks for your solutions. Version b returns concatenated unique values in column C associated with unique values in column A; and version d returns concatenated unique values in column C associated with each value (row) in column A. Perfect solutions thank you and super fast to execute for 240,000 rows on an intel i7, 16GB Ram laptop.


You're welcome & thanks for replying
 
Upvote 0

Forum statistics

Threads
1,215,390
Messages
6,124,670
Members
449,178
Latest member
Emilou

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