Count of populated columns
Posted: Fri Aug 19, 2005 5:52 am
Hi,
I have a question which I hope someone will be able to help me with.
I have a series of records which consist of payments over a given
period (11). Therfore there are 11 fields, some will be populated with 0 (i.e. no purchase) and other columns would be populated with a value eg 10.00(showing a purchase). What I need to do is to count all the columns in each >record where the purchase value is greater than 0 and then use this number to divide the sum of all the columns)
an example of the format is below
10, 0, 14.5, 0, 12.5, 0, 118.91
0, 0, 0, 11.8, 0, 55, 837.4
0, 0, 0, 5, 0, 0, 0
in the first example I would devide (155.91) by 4, the second example (904) by 3 and the final example (5) by 1. I am experimenting with setting up a staging variable to use as a counter in order to try and achieve my result but would like to know if anyone could recomend a simpler and cleaner way to achieve this.
I have a question which I hope someone will be able to help me with.
I have a series of records which consist of payments over a given
period (11). Therfore there are 11 fields, some will be populated with 0 (i.e. no purchase) and other columns would be populated with a value eg 10.00(showing a purchase). What I need to do is to count all the columns in each >record where the purchase value is greater than 0 and then use this number to divide the sum of all the columns)
an example of the format is below
10, 0, 14.5, 0, 12.5, 0, 118.91
0, 0, 0, 11.8, 0, 55, 837.4
0, 0, 0, 5, 0, 0, 0
in the first example I would devide (155.91) by 4, the second example (904) by 3 and the final example (5) by 1. I am experimenting with setting up a staging variable to use as a counter in order to try and achieve my result but would like to know if anyone could recomend a simpler and cleaner way to achieve this.