How about something like this in D1499:

=SUMIF(L2:L1497,"*total",D2:D1497)

i.e. add from those cells in column D where column L cells contain the word Total.

Hope this helps.

Pete