I have a list of numbers which are either 1's or 2's. What I'd like to do is count how many 1's there are before a 2 appears, and then keep repeating this down the list (i'm trying to find the average number of 1's between each 2).

What would be the best way of doing this considering I've got over 10,000 rows? (i.e. too many to do manually)