No need for code at all - a SUMIFS formula is enough.
I can't give the specific formula jet, as obviously some essential information is missing. P.e. there must be some column with year or date in Sheet 2 - otherwise amounts for all years of specific account will be same. And what are vendors in your code - accounts or something else?
|