I am looking for a code to ignore all the #N/A values in the column of data, and find the average of all the remaining cells, and return this average value to a cell. Currently I have this code; it works if the selected data range contains no #N/A, however if there are some #N/A data points, the entire average just returns as #N/A. 

I have also tried this code and to no avail (DateRange is the range of dates that is user specified in my sheet, I want to show the value returned in cell O5):

```
Range("O5").Value = Worksheets("Sheet1").Range(DateRange).Formula = "=AVERAGE(IF(ISNUMBER(DateRange)),DateRange"

```

The working code for no values of #N/A:

```
Dim DataPts As Range
Set DataPts = Range(FromDateCell, ToDateCell).Offset(0, 1)
Range("O5").Value = Application.Average(DataPts)

```

Many thanks in advance.