This problem can be solved with the SUMIFS function and the COUNTIFS function, as explained below.
For convenience,age(E5:E16) andamount(D5:D16) arenamed ranges.
SUMIFS function
TheSUMIFS functionis designed to sum cells that meet multiple criteria.
SUMIFS takes at least three arguments like this:
Noticesum_rangeappears first.
SUMIFS is in agroup of eight functionsthat share this syntax.
The difference is that COUNTIFS does not have asum_rangeargument.
Criteria can be applied to dates, numbers, and text.