EDITED: I'd forgotten to mention what $X$1:$Z$1 referred to!
OK.....I think I have something you can work with.
Using the information you posted
AND
assuming that range is in A1:T17
AND
X1: a
Y1: d
Z1: n
Then
This ARRAY FORMULA counts the groups of cells in the referenced row
where SIX consecutive cells equal "a" or "d" or "n"
in cell V1:
=SUMPRODUCT(--(FREQUENCY(IF(--ISNUMBER(MATCH(A1:T1,$X$1:$Z$1,0)),COLUMN(A1:T1)),IF(--ISNUMBER(MATCH(A1:T1,$X$1:$Z$1,0))=0,COLUMN(A1:T1)))=6))
ALTERNATIVELY, if you don't want to look-up a, d, and n in other cells, you can embed them in the formula:
V1: =SUMPRODUCT(--(FREQUENCY(IF(--ISNUMBER(MATCH(A1:T1,{"A","D","N"},0)),COLUMN(A1:T1)),IF(--ISNUMBER(MATCH(A1:T1,{"A","D","N"},0))=0,COLUMN(A1:T1)))=6))
Copy V1 into cell V3, V5, etc
Note_1:
ARRAY FORMULAS are committed with CTRL+SHIFT+ENTER,
instead of just ENTER
NOTE_2:
To count the groups of SEVEN, change the final 6 to a 7.
In my testing, the formula returned these counts of 6's:
V1 0
V3 1
V5 2
V7 2
V9 2
V11 1
V13 0
V15 2
V17 1
When adjusted for 7's...only the last formula returned a 1, the others returned 0's
Does that do what you want?
Post back if you have more questions.
Bookmarks