POI-XSSF: cell type is FORMULA, but not able to get cachedResultType
<p>In my code, i am checking for the cell type and if the cell type is formula, then i am trying to get the cached value, like this:</p>

<pre><code>else if(cell.getCellType() == XSSFCell.CELL_TYPE_FORMULA){
        System.out.println("formula result type:" +cell.getCachedFormulaResultType());
        switch(cell.getCachedFormulaResultType()){
            case XSSFCell.CELL_TYPE_NUMERIC:
                    ....    
                    ....        
            break;
</code></pre>

<p>It works fine for some cells, but in one of the cells, i get ILLEGAL STATE EXCEPTION:</p>

<pre><code>java.lang.IllegalStateException: Only formula cells have cached results
</code></pre>

<p>I am not able to find out the cause for the error.
I am not using <code>cell.getCachedFormulaResult()</code> outside of this <code>else if</code>, and even this works for all of the preceding cells (which have the same formula)</p>