Put below formula in C7 & drag :

Formula: copy to clipboard
=IFERROR(SUMIFS(INDIRECT(C$6&"!G:G"),INDIRECT(C$6&"!A:A"),$B7),0)


Cheers!