Cantrecallmyusername
Board Regular
- Joined
- May 24, 2021
- Messages
- 50
- Office Version
- 365
- Platform
- Windows
Hey there,
I have a dump of data which contains many rows - these rows contain common data in column A and B but there are variables in the other columns which I want to be combined in to the same cell. My dump file has ~9k rows and I am expecting the output to have ~700.
I have been utilising the below script however I am noticing that the expected output is not working as expected.
For one example I have noticed that it is combining the data in columns A,B,C as one input where I am expecting it to split the data based on the difference in column c
This is what I am expecting as a result;
What I am getting is ;
I have a dump of data which contains many rows - these rows contain common data in column A and B but there are variables in the other columns which I want to be combined in to the same cell. My dump file has ~9k rows and I am expecting the output to have ~700.
I have been utilising the below script however I am noticing that the expected output is not working as expected.
VBA Code:
Ary = Sheets("Dump").Range("A1").CurrentRegion.Value2
ReDim Nary(1 To UBound(Ary), 1 To UBound(Ary, 2))
For r = 2 To UBound(Ary)
If Ary(r, 1) <> Ary(r - 1, 1) Then
nr = nr + 1
For c = 1 To UBound(Ary, 2)
Nary(nr, c) = Ary(r, c)
Next c
Else
For c = 1 To UBound(Ary, 2)
If InStr(1, Nary(nr, c), Ary(r, c), 1) = 0 Then Nary(nr, c) = Nary(nr, c) & vbLf & Ary(r, c)
Next c
End If
Next r
Sheets("Output").Range("A6").Resize(nr, UBound(Nary, 2)).Value = Nary
For one example I have noticed that it is combining the data in columns A,B,C as one input where I am expecting it to split the data based on the difference in column c
This is what I am expecting as a result;
Communication Monitoring | Communications surveillance of staff | FIL Holdings (Luxembourg) S.A. |
Communication Monitoring | Communications surveillance of staff | FIL Investments (Japan) Limited FIL Asia Holdings Pte Limited - Hong Kong Branch |
What I am getting is ;
Communication Monitoring | Communications surveillance of staff | FIL Holdings (Luxembourg) S.A. FIL Investments (Japan) Limited FIL Asia Holdings Pte Limited - Hong Kong Branch |