Sorry just re read your original mail and noticed that you are using Alans method. Still keep in mind you can index directly with the boolean result of the comparison which saves the nonzero() call if speed is an issue. Cheers Robin