Try this: AVGBLK = (( + (IFNULL(BLK1,0,BLK1)) + + (IFNULL(BLK2,0,BLK2)) + + (IFNULL(BLK3,0,BLK3))) / + ((IFNULL(BLK1,0,1)) + + (IFNULL(BLK2,0,1)) + + (IFNULL(BLK3,0,1)))
--- "McClure, Cheryl" <[EMAIL PROTECTED]> wrote: > Running the latest version of R:BASE 7.1: > > I need help to control how an average is calculated when one or more of > the values in the series is dropped. Whether or not this is considered > the proper way to average a set of numbers, this is what I have been > asked to accomplish. > > I have three numerical columns (BLK1, BLK2, BLK3) in a table which are > then averaged in another column AVGBLK = (LAVG(BLK1,BLK2,BLK3)). After > the data is manually evaluated it is possible that the value in one or > more of the columns will be removed (set to null). I have been told to > make it work so that if there are only two valid numbers then the > average should be divided by two instead of three. LAVG continues to > divide by three whether zero is set on or off. What other method can I > use to control this? > > Thanks in advance! > > Cheryl > > Albert Berry Management Consultant RR2 - 1252 Ponderosa Drive Sparwood BC, V0B 2G2 Canada (250) 425-5806 (250) 425-7259 (708) 575-3952 (fax) [EMAIL PROTECTED]
