Ok, I think I oversimplified the example worksheet and just made it more confusing. Let me add another one and see if I can explain it a little better.
In column A, I have a list of ID's. There will be multiple duplicate ID's and then a new ID. At each change in ID, I need a new grand sum in column F. At the same time, I need any duplicated line numbers from column B (within the same ID number from column A) to not be included in the grand total in column F.
I have included the totals I am looking for the function to generate in column F. Here is one of the functions I have tried:
=SUMPRODUCT(--($A$21:$A$38=A21),$E$21:$E$38)
This function works to sum the totals with each change in ID number from column A, but does not address the duplicate line number problem.
Sorry for all of the confusion. Hope this helps clear some of it up.