ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Remove duplicates (https://www.excelbanter.com/excel-programming/453701-remove-duplicates.html)

Jesper Kaas

Remove duplicates
 
Hi

I have an array of datastructures with 3 elements: ID, sum and
accountnumber:
Type Bill
ID as String
Price as Long
accountnumber as string
End Type
Public Bills(200) as Bill

The accountnumbers are not unique per ID, several ID's can have the
same accountnumber.
I need to write a list on a sheet with accountnumber in one column and
the sum of prices connected to that accountnumber in the next column.
Is there a smart way of doing this?
My first thought was som kind of nested loops, but it will be quite
ugly, and I could not really get my head around it.
Second thought is using the sheet as a kind of draft, writing the list
of accountnumbers down a column, an then use the function
RemoveDuplicates to get the unique accountnumbers. Next read them in
to a datastructure with accountnumbers and price. At last a nested
loop going through the list of unique numbers in the outer loop and
the list Bills as the inner loop.
There must be a better way. Hope someone sees it :-)

Best regards



--
Jesper Kaas -


All times are GMT +1. The time now is 01:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com