Hello Elegbede, > I have a 4 by 4 matrix filled with 0s, 1s and 2s. > I want to loop through the whole matrix to get the fields with 1s and 2s > only and then count how many ones and how many twos. http://dpaste.org/UI5A/ HTH. -kk -- To know that we know what we know, and that we do not know what we do not know, that is true knowledge.