Try this formula in AB3 and drag it down:
Formula: copy to clipboard
=SUMPRODUCT(($EW$3:$FA$38=AA3)*($FK$3:$FK$38=RIGHT($AB$2,1)))