Columns D:I are "helper" columns and compute the six two digit permutations of the three digit number in col-A. The formula in D1 is:
Formulas in E1:I1 are more or less similar. D1:I1 can be copied down as far as is needed.
In rows 8 through 26 the helper columns G:I are not required and have been omitted.
These helper columns can be relocated to wherever is convenient for your real workbook.
Your required formula for the first block of calculations is in B8:B26. In B8 then copied down to B26:
=SUMPRODUCT(($D$1:$I$7=D8)+($D$1:$I$7=E8)+($D$1:$I$7=F8))
I don't know how many "blocks" of calculations you have. Your example has two: Rows 1 thru 26 and rows 27 thru 52. The above formula needs manual changes for each block. So in B34 then copied down to B52:
=SUMPRODUCT(($D$27:$I$33=D34)+($D$27:$I$33=E34)+($D$27:$I$33=F34))
If you have many calculation blocks you may want a more copy/paste-friendly formula.
I moved your expected results to col-C. My formulas agree with your expected results.
The attached workbook implements the above.
Let me know if this works for you.
Bookmarks