# result of setFormula() not recognised (solved) [closed]

The following line of code inserts a formula using the function COUNTIF into cell F43.

```
oSheet.getCellByPosition(5,42).setFormula("=COUNTIF(F33:F36,1)")
```

The formula is inserted in the cell exactly as expected, but the result in the spreadsheet is Err:508. (I tried ""=1"", but the result is the same.) I can manually copy and paste the formula from the formula bar back in to the formula bar and it then works correctly. A similar expression using a SUM function in place of COUNTIF works correctly. Is there some limitation on which functions can be used in setFormula? Or am I missing something?

When the sheet is copied from elsewhere, Calc seems to be deciding that the column F is all DATES. This may have something to do with problem, but does not entirely explain it. The problem reproduces in another column. Now there is a second less important question: why is Col F becoming DATES?