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.
[TABLE="width: 658"]
<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>[TR]
[TD="width: 92, bgcolor: transparent"]JEIdentifier[/TD]
[TD="width: 111, bgcolor: transparent"]AccountType[/TD]
[TD="width: 140, bgcolor: transparent"]AccountType2[/TD]
[TD="width: 316, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000101994[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities, d|Liabilities, c|Assets, d|Assets[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000101994[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102019[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] c|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102019[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] d|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102154[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102154[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102155[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102155[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102156[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102156[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102157[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102157[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102158[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102158[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102159[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102159[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102160[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102160[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102160[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102163[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102163[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102163[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102225[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] c|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102225[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] d|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
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
[TABLE="width: 658"]
<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>[TR]
[TD="width: 92, bgcolor: transparent"]JEIdentifier[/TD]
[TD="width: 111, bgcolor: transparent"]AccountType[/TD]
[TD="width: 140, bgcolor: transparent"]AccountType2[/TD]
[TD="width: 316, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000101994[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities, d|Liabilities, c|Assets, d|Assets[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000101994[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102019[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] c|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102019[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] d|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102154[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102154[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102155[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102155[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102156[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102156[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102157[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102157[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102158[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102158[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102159[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102159[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102160[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102160[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102160[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102163[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] c|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102163[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102163[/TD]
[TD="bgcolor: transparent"]Liabilities[/TD]
[TD="bgcolor: transparent"] d|Liabilities[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102225[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] c|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1000102225[/TD]
[TD="bgcolor: transparent"]Assets[/TD]
[TD="bgcolor: transparent"] d|Assets[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
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