I have a bit of a problem and I'll try to be brief. I have a small 4 col - 20 row table.
Col 1 (C4-C23) is the count of products received.
Col 2 (D4-D23) is the total cost of the product received.
Col 3 (E4-E23) indicates whether the delivery is a unit or a case.
Col 4 (F4-F23) contains a formula which divides the cost by the case or the unit cost (In this case the divisor is 24, cause we're talkin beer)

Above the table in cell F3 I have manually entered the previous unit cost and I want to average the unit cost at the bottom of the F col in cell F24. The two formulas I hve tried in cells f4-23 are:

=IF(E4="c",(D4/C4)/24,D4/C4) or =IF(AND(D4>0,E4="c"),(D4/C4)/24,D4/C4)

Both work, but my problem is that I am trying to average Col F in cell F24 and I don't know how to deal with #DIV/0!.

My work around has been to enter a 1 in all the count columns and use the following formula in cell F24: =SUM(F3:F23)/COUNTIF(F3:F23,">0"). Seems to work okay, but us old folk like to be neat.

Any help would be greatly appreciated.

Dean