I have a 2D array that I know will have duplicate Text items in column 1.The array is already sorted so the duplicate items will be contiguous. I will have at most 3 repeated rows and at least 2 repeated rows.
I effectively want to consolidate the repeated rows, clear values in erroneous rows, and then resize the array (i.e. delete erroneous rows). To resize the array I will pass all the non empty rows to a dictionary and then back to a new smaller array.
Most all other columns have values as numbers which I will have to sum.
I am assuming my best approach will be to identify how may first column repeats exist by doing a first pass of the array by looping and creating an index.
[1,1,1,2,2,3,3,4,4,4,5,5,6,6,6,....
or an array that highlights the position of how may rows following are associated with the given row
[3,3,3,5,5,7,7,10,10,10,12,12,15,15,15 (i.e. first three rows repeat so rows 1-3 are tied to row 3).
Then use this index while looping through the array again to start the consolidation and clearing of data.
Does this sound like the right approach and if so, any ideas on how to create the index for the first pass?
Thanks
I effectively want to consolidate the repeated rows, clear values in erroneous rows, and then resize the array (i.e. delete erroneous rows). To resize the array I will pass all the non empty rows to a dictionary and then back to a new smaller array.
Most all other columns have values as numbers which I will have to sum.
I am assuming my best approach will be to identify how may first column repeats exist by doing a first pass of the array by looping and creating an index.
[1,1,1,2,2,3,3,4,4,4,5,5,6,6,6,....
or an array that highlights the position of how may rows following are associated with the given row
[3,3,3,5,5,7,7,10,10,10,12,12,15,15,15 (i.e. first three rows repeat so rows 1-3 are tied to row 3).
Then use this index while looping through the array again to start the consolidation and clearing of data.
Does this sound like the right approach and if so, any ideas on how to create the index for the first pass?
Thanks