Hi David ,
The reason the formula does not work in one case while it works in the other is very straightforward ; the formula is being used without an understanding of how it works !
It all comes back to what I have been saying in the past ; use Excel to implement correct logic , which means first draft the logic in plain English , verify that it is complete and correct , and then see how this logic can be converted to Excel formulae.
What the formula is doing is creating 2 matrices ; each matrix is 644 rows by 5 columns ; after creating these matrices , it is doing an arithmetic multiplication , not a matrix multiplication , which means the first element of the first matrix is multiplied by the first element of the second matrix , for all the elements.
Thus a 1 will result if an element in row x and column y of the first matrix is equal to the first check value , say the value in I1 or I2 , and if the corresponding element ( row x and column y ) of the second matrix is equal to the second check value , which is the value in J1 or J2.
By coincidence , for the second formula you have chosen values which are consecutively arranged ! Thus , because the two check values occur consecutively , the positions are the same in both matrices , but this is pure coincidence. For the second formula , instead of 17 , choose 18 and see what you get. Thus , the formula will give an expected result only if the 2 check values occur in the same position in both matrices i.e. if the two check values are always next to each other in the same orientation , meaning the first check value should occur first , immediately followed by the second check value.
The problem is knowing what you want ; I never start with a formula and decipher why it works or does not work ; I always start with the logic of what is to be done , and see how a formula can be built using the basic building blocks , which will implement the logic.
Mastery of the basic building blocks , and their combinations is a must before one tries to develop complicated / complex formulae.
Narayan