Need to use IF to AVERAGE 2 separate references

B

BLB

I'm using the AVERAGE function to calculate the average of numbers, bu
excluding zeroes. The problem is that I am trying to calculate
separate references. Normally you would use a comma to separate the
references, but because the IF function uses the comma to separate it
arguments, this doesn't work. For example:

={AVERAGE(IF(A3:A5<>0),A3:A5)}

or the same formula NOT using the array formula would be:

=SUM(A3:A5)/COUNTIF(A3:A5,"<>0")

However, my problem is that I want to calculate the average betwee
A3:A5 and D3:D5. Do I need to use a nested IF? If so, how? Becaus
the following doesn't work:

={AVERAGE(IF(A3:A5,D3:D5<>0),A3:A5,D3:D5)} ---> obviously there ar
too many arguments in this formula. I tried the OR function, but i
doesn't return the correct answer. I also tried putting parenthasi
around just the 2 references
 
B

BLB

Never mind, I figured it out. It needs to be this:

=SUM(A3:A5)/SUM(COUNTIF(A3:A5,"<>0"),COUNTIF(D3:D5,"<>0"))


:cool
 
Top