there's some macros to sum amounts:
I'd say you can pair it with this one to go trough every line:
For more information, see the wiki Searching the Forum for Answers section.