I have 7 variables which can in principle be between 0 and 10. (Up to) 2 of those are usually 0 and therefore "not interesting" and I would like to skip them when checking if the variables are the same. So, put differently, I would like to check if the non-zero values are the same.
An example, I have these 7 variable: 1 0 1 0 1 1 1, so the non-zero are all 1 and therefore the same.
Second example: 1 0 2 1 0 1 1, the non-zero variables are not the same, therefore False.
I thought I could reduce my 7 variable to just the 5 non-zero ones and then check if they are the same by using
=IF(AND(b1=b2,b2=b3,b3=b4,b4=b5),1,0)
But I am not sure how to get from the 7 to the 5 variables, even if I know the position of the zero values.
Here what I tried in Excel:
Columns A-G are the 7 variables, the input, in column G and H I figure out where the 0s are located with the idea to skip them BUT I cannot figure out how to get to b1-b5, I had to do it manually in the example.
Any ideas? Maybe an array formula?




