简体   繁体   中英

Calculate Hat Trick Wins in a Matrix

I would like to have a script or formula to calculate the number of three consecutive "W" values on a row of 64 cells from left to right and display the result in a column labeled "Hat Tricks". The formula/script must be able to be copied to multiple other rows.

I have drafted an example sheet here .

The data is a matrix of wrestlers who compete against each other, and the win or loss is recorded in a matrix. The nature of the matrix ignores the cell where the wrestler cannot compete against themselves, thus this will need to be configured into the script/formula. Here is a quick example of what I mean, where x is a competition with the self and the numbers are wrestler IDs:

1  2  3
1 x  L  L
2 W  x  L
3 W  W  x

I am just a hobbyist without a lot of coding knowledge. I am appreciative of any attention this post generates. Thanks for taking the time.

try:

=ARRAYFORMULA(LEN(REGEXREPLACE(REGEXREPLACE(TRIM(FLATTEN(QUERY(
 TRANSPOSE(B2:G7),,9^9))), "W W W", "1"), "[WL ]", )))

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM