Zend certified PHP/Magento developer

Excel: AverageIf Multiple Criteria, sometimes one criteria will be empty

I need a formula that finds the average of multiple criteria even if one of the criteria happens to be blank. For instance, I want to find the average of how many apples and oranges, even if oranges happens to be 0 or blank.

I could do the average of both averages of apples and oranges, but average of averages is not completely accurate.

I have a formula that I was told should work, but when I put it in, it says #N/A: Wrong number of arguments to IF, Expected between 2 and 3 arguments, but got 4 arguments. If I can have help making it work, it seems like it is what I am looking for. I am open to other ideas as well.

=AVERAGE(IF(‘Data’!C:D,”Item 1″,”Item 2″,’Data’!D:D))