Hello Kok Kik,

When you use POI to 'read' the value of a formula cell, are you using
HSSFCell.getNumericCellValue() or HSSFFormulaEvaluator.evaluate(Cell)?

Calling HSSFCell.get~CellValue() on a formula cell will only return the
cached formula result (as last set by Excel or possibly POI).  Excel usually
sets those cached results correctly, but if they were wrong, it could
explain what you are seeing.  Furthermore, these values aren't automatically
updated by POI.  So if you have changed other cell values that the formula
depends upon, the cached value will probably be wrong.  Depending on option
flags, Excel may recalculate formulas when you open the workbook.  The
formula cell value you see in Excel may not be the same as what is read in
POI with HSSFCell.get~CellValue(), which can be confusing.

On the other hand, if you are using HSSFFormulaEvaluator.evaluate(Cell) you
won't have those problems (it ignores the cached formula results saved by
Excel).   Instead, HSSFFormulaEvaluator does its own caching, so if you need
to change formula input values *during* evaluations you'll also need to call
HSSFFormulaEvaluator.notifyUpdateCell(HSSFCell) to keep things in sync.

If this doesn't help, please open a bugzilla bug (
https://issues.apache.org/bugzilla/enter_bug.cgi), upload the sample file
and some java code to reproduce the problem.

regards,
Josh

Reply via email to