[Tutor] List processing question - consolidating duplicate entries

Richard Querin rfquerin at gmail.com
Tue Nov 27 22:37:52 CET 2007

I'm trying to process a list and I'm stuck. Hopefully someone can help
me out here:

I've got a list that is formatted as follows:

An example might be:


Now I'd like to consolidate entries that are duplicates. Duplicates
meaning entries that share the same Name, job#, jobname and workcode.
So for the list above, there are 3 entries for projectA which have a
workcode of 4001. (there is a fourth entry for projectA but it's
workcode is 5001 and not 4001).

So I'd like to end up with a list so that the three duplicate entries
are consolidated into one with their hours added up:


I've tried doing it with brute force by stepping through each item and
checking all the other items for matches, and then trying to build a
new list as I go, but that's still confusing me - for instance how can
I delete the items that I've already consolidated so they don't get
processed again?.

I'm not a programmer by trade so I'm sorry if this is a basic computer
science question.


More information about the Tutor mailing list