One final idea. If you're willing to use a helper column, this works:
| A | B | C | D | E | F | G |
---|
Helper | Formula3 | Formula1 | Formula2 | shg's Formula | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
9 | | | | | | | |
| | | | | | | |
<tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]4[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]10[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
</tbody>
Sheet8
[TABLE="width: 85%"]
<tbody>[TR]
[TD]
Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula
[/TH]
[/TR]
[TR]
[TH]G2[/TH]
[TD="align: left"]=SUMPRODUCT(
--(--(A2:A8 & A3:A9 & A4:A10) = {123,132,213,231,312,321}))
[/TD]
[/TR]
[TR]
[TH]B2[/TH]
[TD="align: left"]=IF(
PRODUCT(COUNTIF(A2:A4,{1,2,3}))*SUM(A2:A4)=6,1,"")[/TD]
[/TR]
[TR]
[TH]C2[/TH]
[TD="align: left"]=SUM(
B:B)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 85%"]
<tbody>[TR]
[TD]
Array Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]E2[/TH]
[TD="align: left"]{=SUM(
IFERROR(CHOOSE($A$2:$A$8,CHOOSE($A$3:$A$9,0,CHOOSE($A$4:$A$10,0,0,1),CHO
OSE($A$4:$A$10,0,1,0)),CHOOSE($A$3:$A$9,CHOOSE($A$4:$A$10,0,0,1),0,CHOOSE($A$4:$A$10,1,0,0)),CHOOSE($A$3:$A$9,CHOOSE($A$4:$A$10,0,1,0),CHOOSE($A$4:$A$10,1,0,0),0)),0))}[/TD]
[/TR]
[TR]
[TH]F2[/TH]
[TD="align: left"]{=SUM(
IFERROR(IF((MATCH($A$2:$A$8,{1,2,99,3},0)+MATCH($A$3:$A$9,{1,2,99,3},0)+MATCH($A$4:$A$10,{1,2,99,3},0)=7)*(SUBTOTAL(9,OFFSET($A$2,ROW($A$2:$A$8)-ROW($A$2),0,3))=6),1),0))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
Put the formula in B2 and drag down. Each triad is marked with a 1, and the sum of column B (the C2 formula) is the number of triads.