Counting number of triads

lculph

New Member
Joined
Apr 11, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I'm trying to count the number of triads completed in a Y-Maze test (see im
Y maze.png
age)
A complete triad is when a mouse moves from B > C > A, B > A > C, C > A > B etc. If the mouse goes B > A > B the triad in not complete.

My data is expressed just as a list of BABABCBAB etc.
Is there a way I can count the amount of triads complete? If there is a direction change from clockwise to anti-clockwise that is ok, as long as the triad is complete.

Thanks! :)
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
@lculph Welcome
Can you clarify a couple of points?
Is your list one letter per row?
Indication of typical max number of rows?
Are the triads mutually exclusive such that in this example the count is 2 not 3 ?

Book1
AB
2B
3A
4B
5A
6B
7C
8B
9A
10B
11C
12
Sheet1
 
Upvote 0
A Google would lead me to believe that the triads (SAPs) are not necessarily discrete.
So maybe along these lines might help?
Utilising a helper column which could be hidden if required.

Book1
ABCD
1Arm TriadTriad Total
2C13
3B
4C0
5A1
6B1
7A0
8B0
9A0
10C1
11A0
12B1
13A0
14C1
15A0
16B1
17B0
18C0
19C0
20B0
21A1
22C1
23B1
24B0
25A0
26C1
27B1
28C0
29A1
30C0
31A0
32B1
33A0
34 
35 
Sheet1
Cell Formulas
RangeFormula
D2D2=SUM(C2:C40)
C4:C35C4=IFERROR(IF(SUM(CODE($A2:$A4))=198,1,0),"")
 
Upvote 0
Another option
Excel Formula:
=LET(r,ROWS(A2:A33),SUM(--(MMULT((SEQUENCE(r,,3)>=SEQUENCE(,r))*(SEQUENCE(r)<=SEQUENCE(,r)),CODE(A2:A33))=198)))
 
Upvote 0
If your data is all in one cell, you could use
+Fluff 1.xlsm
EF
3
4CBCABABACABACABBCCBACBBACBCACABA13
5BABABCBAB2
Data
Cell Formulas
RangeFormula
F4:F5F4=SUM(SIGN(HEX2DEC(BYROW(MID(E4,SEQUENCE(LEN(E4)-2),3),LAMBDA(r,CONCAT(SORT(MID(r,{1;2;3},1))))))=2748))
 
Upvote 0
Gone slightly OTT on the previous formula, there's no need for the hex2dec function
Excel Formula:
=SUM(SIGN(BYROW(MID(D4,SEQUENCE(LEN(D4)-2),3),LAMBDA(r,CONCAT(SORT(MID(r,{1;2;3},1)))))="ABC"))
 
Upvote 0

Forum statistics

Threads
1,224,830
Messages
6,181,229
Members
453,026
Latest member
cknader

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top