Your idea looks good. But before we move on, can I see if what you want to do is to count the sum of values? If so, the above code I wrote earlier is enough and easier?