Hello.
I have data in the first 5 columns, and 200+ rows, with no duplicates in each row. I want to see how many times certain values appear together in the same row, regardless of their column.
For example:
03 04 05 07 09
10 23 05 09 44
07 08 23 70 12
23 24 25 07 05
and so on (added zeroes for spacing)
Next to it i have headers from 2 through 70, and row headers from 1 through 70.
In that top left cell, I have the formula below, and copied to the entire matrix, and then I go back and delete the reverse duplicates. (2 & 5 is the same as 5 & 2)
The number output tells me how many times the row and header values appear in the data, together in the same row, no matter the column they appear on.
So, all of these would be a match and be counted:
Then I made another section, to see how many times the number on the left, appears with two sequential numbers from 2/3, 3/4, 4/5, etc.
But this time, the countifs() code was horrendously long!
Now I want to count how many times the number came out with 2/4, 3/5, 4/6, 5/7, etc. Then again with 2/5, 3/6, 4/7, 5/8, etc, etc, etc.
Eventually, I want to expand this to 3 consecutive numbers (2/3/4), and then skip a number (2/4/5), and then skip 2 numbers (2/5/6) etc ad nauseam.
Is there an easier way to do this?
I have data in the first 5 columns, and 200+ rows, with no duplicates in each row. I want to see how many times certain values appear together in the same row, regardless of their column.
For example:
03 04 05 07 09
10 23 05 09 44
07 08 23 70 12
23 24 25 07 05
and so on (added zeroes for spacing)
Next to it i have headers from 2 through 70, and row headers from 1 through 70.
In that top left cell, I have the formula below, and copied to the entire matrix, and then I go back and delete the reverse duplicates. (2 & 5 is the same as 5 & 2)
Excel Formula:
=SUM(
COUNTIFS($A:$A,$G2,$B:$B,H$1), COUNTIFS($A:$A,$G2,$C:$C,H$1), COUNTIFS($A:$A,$G2,$D:$D,H$1), COUNTIFS($A:$A,$G2,$E:$E,H$1), COUNTIFS($B:$B,$G2,$A:$A,H$1),
COUNTIFS($B:$B,$G2,$C:$C,H$1), COUNTIFS($B:$B,$G2,$D:$D,H$1), COUNTIFS($B:$B,$G2,$E:$E,H$1), COUNTIFS($C:$C,$G2,$A:$A,H$1), COUNTIFS($C:$C,$G2,$B:$B,H$1),
COUNTIFS($C:$C,$G2,$D:$D,H$1), COUNTIFS($C:$C,$G2,$E:$E,H$1), COUNTIFS($D:$D,$G2,$A:$A,H$1), COUNTIFS($D:$D,$G2,$B:$B,H$1), COUNTIFS($D:$D,$G2,$C:$C,H$1),
COUNTIFS($D:$D,$G2,$E:$E,H$1), COUNTIFS($E:$E,$G2,$A:$A,H$1), COUNTIFS($E:$E,$G2,$B:$B,H$1), COUNTIFS($E:$E,$G2,$C:$C,H$1), COUNTIFS($E:$E,$G2,$D:$D,H$1)
)
The number output tells me how many times the row and header values appear in the data, together in the same row, no matter the column they appear on.
So, all of these would be a match and be counted:
Code:
1-2-x-x-x, x-1-2-x-x, x-x-1-2-x, x-x-x-1-2, 2-x-x-x-1
1-x-2-x-x, x-1-x-2-x, x-x-1-x-2, 2-x-x-1-x, x-2-x-x-1
1-x-x-2-x, x-1-x-x-2, 2-x-1-x-x, x-2-x-1-x, x-x-2-x-1
1-x-x-x-2, 2-1-x-x-x, x-2-1-x-x, x-x-2-1-x, x-x-x-2-1
Then I made another section, to see how many times the number on the left, appears with two sequential numbers from 2/3, 3/4, 4/5, etc.
But this time, the countifs() code was horrendously long!
Excel Formula:
=SUM(
AND(COUNTIFS($B:$B,$H2,$C:$C,I$1), COUNTIFS($B:$B,$H2,$C:$C,I$1,$D:$D,j$1)),
AND(COUNTIFS($B:$B,$H2,$C:$C,I$1), COUNTIFS($B:$B,$H2,$C:$C,I$1,$E:$E,j$1)),
AND(COUNTIFS($B:$B,$H2,$C:$C,I$1), COUNTIFS($B:$B,$H2,$C:$C,I$1,$F:$F,j$1)),
AND(COUNTIFS($B:$B,$H2,$d:$d,I$1), COUNTIFS($B:$B,$H2,$d:$d,I$1,$C:$C,J$1)),
AND(COUNTIFS($B:$B,$H2,$d:$d,I$1), COUNTIFS($B:$B,$H2,$d:$d,I$1,$E:$E,J$1)),
AND(COUNTIFS($B:$B,$H2,$d:$d,I$1), COUNTIFS($B:$B,$H2,$d:$d,I$1,$F:$F,J$1)),
AND(COUNTIFS($B:$B,$H2,$e:$e,I$1), COUNTIFS($B:$B,$H2,$e:$e,I$1,$C:$C,J$1)),
AND(COUNTIFS($B:$B,$H2,$e:$e,I$1), COUNTIFS($B:$B,$H2,$e:$e,I$1,$D:$D,j$1)),
AND(COUNTIFS($B:$B,$H2,$e:$e,I$1), COUNTIFS($B:$B,$H2,$e:$e,I$1,$F:$F,j$1)),
AND(COUNTIFS($B:$B,$H2,$f:$f,I$1), COUNTIFS($B:$B,$H2,$f:$f,I$1,$C:$C,J$1)),
AND(COUNTIFS($B:$B,$H2,$f:$f,I$1), COUNTIFS($B:$B,$H2,$f:$f,I$1,$D:$D,j$1)),
AND(COUNTIFS($B:$B,$H2,$f:$f,I$1), COUNTIFS($B:$B,$H2,$f:$f,I$1,$E:$E,J$1)),
AND(COUNTIFS($C:$C,$H2,$d:$d,I$1), COUNTIFS($C:$C,$H2,$d:$d,I$1,$B:$B,j$1)),
AND(COUNTIFS($C:$C,$H2,$d:$d,I$1), COUNTIFS($C:$C,$H2,$d:$d,I$1,$E:$E,j$1)),
AND(COUNTIFS($C:$C,$H2,$d:$d,I$1), COUNTIFS($C:$C,$H2,$d:$d,I$1,$F:$F,j$1)),
AND(COUNTIFS($C:$C,$H2,$e:$e,I$1), COUNTIFS($C:$C,$H2,$e:$e,I$1,$B:$B,j$1)),
AND(COUNTIFS($C:$C,$H2,$e:$e,I$1), COUNTIFS($C:$C,$H2,$e:$e,I$1,$D:$D,j$1)),
AND(COUNTIFS($C:$C,$H2,$e:$e,I$1), COUNTIFS($C:$C,$H2,$e:$e,I$1,$F:$F,j$1)),
AND(COUNTIFS($C:$C,$H2,$f:$f,I$1), COUNTIFS($C:$C,$H2,$f:$f,I$1,$B:$B,j$1)),
AND(COUNTIFS($C:$C,$H2,$f:$f,I$1), COUNTIFS($C:$C,$H2,$f:$f,I$1,$D:$D,j$1)),
AND(COUNTIFS($C:$C,$H2,$f:$f,I$1), COUNTIFS($C:$C,$H2,$f:$f,I$1,$E:$E,j$1)),
AND(COUNTIFS($C:$C,$H2,$B:$B,I$1), COUNTIFS($C:$C,$H2,$B:$B,I$1,$D:$D,j$1)),
AND(COUNTIFS($C:$C,$H2,$B:$B,I$1), COUNTIFS($C:$C,$H2,$B:$B,I$1,$E:$E,j$1)),
AND(COUNTIFS($C:$C,$H2,$B:$B,I$1), COUNTIFS($C:$C,$H2,$B:$B,I$1,$F:$F,j$1)),
AND(COUNTIFS($d:$d,$H2,$B:$B,I$1), COUNTIFS($d:$d,$H2,$B:$B,I$1,$B:$B,j$1)),
AND(COUNTIFS($d:$d,$H2,$B:$B,I$1), COUNTIFS($d:$d,$H2,$B:$B,I$1,$C:$C,j$1)),
AND(COUNTIFS($d:$d,$H2,$B:$B,I$1), COUNTIFS($d:$d,$H2,$B:$B,I$1,$F:$F,j$1)),
AND(COUNTIFS($d:$d,$H2,$C:$C,I$1), COUNTIFS($d:$d,$H2,$C:$C,I$1,$B:$B,j$1)),
AND(COUNTIFS($d:$d,$H2,$C:$C,I$1), COUNTIFS($d:$d,$H2,$C:$C,I$1,$C:$C,j$1)),
AND(COUNTIFS($d:$d,$H2,$C:$C,I$1), COUNTIFS($d:$d,$H2,$C:$C,I$1,$E:$E,j$1)),
AND(COUNTIFS($d:$d,$H2,$e:$e,I$1), COUNTIFS($d:$d,$H2,$e:$e,I$1,$C:$C,j$1)),
AND(COUNTIFS($d:$d,$H2,$e:$e,I$1), COUNTIFS($d:$d,$H2,$e:$e,I$1,$E:$E,j$1)),
AND(COUNTIFS($d:$d,$H2,$e:$e,I$1), COUNTIFS($d:$d,$H2,$e:$e,I$1,$F:$F,j$1)),
AND(COUNTIFS($d:$d,$H2,$f:$f,I$1), COUNTIFS($d:$d,$H2,$f:$f,I$1,$B:$B,j$1)),
AND(COUNTIFS($d:$d,$H2,$f:$f,I$1), COUNTIFS($d:$d,$H2,$f:$f,I$1,$E:$E,j$1)),
AND(COUNTIFS($d:$d,$H2,$f:$f,I$1), COUNTIFS($d:$d,$H2,$f:$f,I$1,$F:$F,j$1)),
AND(COUNTIFS($e:$e,$H2,$B:$B,I$1), COUNTIFS($e:$e,$H2,$B:$B,I$1,$B:$B,j$1)),
AND(COUNTIFS($e:$e,$H2,$B:$B,I$1), COUNTIFS($e:$e,$H2,$B:$B,I$1,$C:$C,j$1)),
AND(COUNTIFS($e:$e,$H2,$B:$B,I$1), COUNTIFS($e:$e,$H2,$B:$B,I$1,$D:$D,j$1)),
AND(COUNTIFS($e:$e,$H2,$C:$C,I$1), COUNTIFS($e:$e,$H2,$C:$C,I$1,$C:$C,j$1)),
AND(COUNTIFS($e:$e,$H2,$C:$C,I$1), COUNTIFS($e:$e,$H2,$C:$C,I$1,$D:$D,j$1)),
AND(COUNTIFS($e:$e,$H2,$C:$C,I$1), COUNTIFS($e:$e,$H2,$C:$C,I$1,$F:$F,j$1)),
AND(COUNTIFS($e:$e,$H2,$d:$d,I$1), COUNTIFS($e:$e,$H2,$d:$d,I$1,$B:$B,j$1)),
AND(COUNTIFS($e:$e,$H2,$d:$d,I$1), COUNTIFS($e:$e,$H2,$d:$d,I$1,$D:$D,j$1)),
AND(COUNTIFS($e:$e,$H2,$d:$d,I$1), COUNTIFS($e:$e,$H2,$d:$d,I$1,$F:$F,j$1)),
AND(COUNTIFS($e:$e,$H2,$f:$f,I$1), COUNTIFS($e:$e,$H2,$f:$f,I$1,$B:$B,j$1)),
AND(COUNTIFS($e:$e,$H2,$f:$f,I$1), COUNTIFS($e:$e,$H2,$f:$f,I$1,$C:$C,j$1)),
AND(COUNTIFS($e:$e,$H2,$f:$f,I$1), COUNTIFS($e:$e,$H2,$f:$f,I$1,$F:$F,j$1)),
AND(COUNTIFS($f:$f,$H2,$B:$B,I$1), COUNTIFS($f:$f,$H2,$B:$B,I$1,$C:$C,j$1)),
AND(COUNTIFS($f:$f,$H2,$B:$B,I$1), COUNTIFS($f:$f,$H2,$B:$B,I$1,$D:$D,j$1)),
AND(COUNTIFS($f:$f,$H2,$B:$B,I$1), COUNTIFS($f:$f,$H2,$B:$B,I$1,$E:$E,j$1)),
AND(COUNTIFS($f:$f,$H2,$C:$C,I$1), COUNTIFS($f:$f,$H2,$C:$C,I$1,$B:$B,j$1)),
AND(COUNTIFS($f:$f,$H2,$C:$C,I$1), COUNTIFS($f:$f,$H2,$C:$C,I$1,$D:$D,j$1)),
AND(COUNTIFS($f:$f,$H2,$C:$C,I$1), COUNTIFS($f:$f,$H2,$C:$C,I$1,$E:$E,j$1)),
AND(COUNTIFS($f:$f,$H2,$d:$d,I$1), COUNTIFS($f:$f,$H2,$d:$d,I$1,$B:$B,j$1)),
AND(COUNTIFS($f:$f,$H2,$d:$d,I$1), COUNTIFS($f:$f,$H2,$d:$d,I$1,$C:$C,j$1)),
AND(COUNTIFS($f:$f,$H2,$d:$d,I$1), COUNTIFS($f:$f,$H2,$d:$d,I$1,$E:$E,j$1)),
AND(COUNTIFS($f:$f,$H2,$e:$e,I$1), COUNTIFS($f:$f,$H2,$e:$e,I$1,$B:$B,j$1)),
AND(COUNTIFS($f:$f,$H2,$e:$e,I$1), COUNTIFS($f:$f,$H2,$e:$e,I$1,$C:$C,j$1)),
AND(COUNTIFS($f:$f,$H2,$e:$e,I$1), COUNTIFS($f:$f,$H2,$e:$e,I$1,$D:$D,j$1)),
)
Now I want to count how many times the number came out with 2/4, 3/5, 4/6, 5/7, etc. Then again with 2/5, 3/6, 4/7, 5/8, etc, etc, etc.
Eventually, I want to expand this to 3 consecutive numbers (2/3/4), and then skip a number (2/4/5), and then skip 2 numbers (2/5/6) etc ad nauseam.
Is there an easier way to do this?