Welcome to the Board.

Note (given first post) I changed your title to something a little more appropriate and in keeping with Forum Rules - going forward please bear the requirements in mind.

Formula wise:

B16:
=SUMPRODUCT(N(INDIRECT(ADDRESS(12-(COLUMN(B16:$K16)-COLUMN(B16)),COLUMN(B16:$K16)))))+SUMPRODUCT(N(INDIRECT(ADDRESS(COLUMN($B16:B16),2+COLUMN(B16)-(COLUMN($B16:B16)),,,"Sheet2"))))
copied across to K16
however, the above is and volatile and brute force - moreover though it generates the correct results for your sample I'm not entirely sure it will be the long term solution.