You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/03/26 14:01:09 UTC

DO NOT REPLY [Bug 44677] New: COUNTA function gives incorrect result

https://issues.apache.org/bugzilla/show_bug.cgi?id=44677

           Summary: COUNTA function gives incorrect result
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: lpoublan@triloggroup.com


When I insert a COUNTA formula in a cell, the result is incorrect.
It seems it only returns the number of parameters.
When I open the excel file with excel (2003), if I edit the formula and just
press enter (force recompute, do not modify the formula), the result becomes
correct.
On the other hand, COUNT works fine.

Laurent


Example:

HSSFWorkbook wb=new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
sheet.createRow(0).createCell((short)0).setCellValue(10);
sheet.createRow(1).createCell((short)0).setCellValue(20);
sheet.createRow(2).createCell((short)0).setCellValue(true);

// the result is 2, which is ok (only numbers are taken into account)
sheet.createRow(3).createCell((short)0).setCellFormula("count(A1:A3)");

// the result is 1, it should be 3
sheet.createRow(4).createCell((short)0).setCellFormula("counta(A1:A3)");


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44677] COUNTA function gives incorrect result

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44677





--- Comment #1 from Josh Micich <jo...@gildedtree.com>  2008-03-26 11:43:43 PST ---
POI currently saves these formulas with tokens of tAreaV(0x45) instead of
tAreaR (0x25).  In my excel (2007) I observe *both* formulas to be wrong at
first (A4=0, A5=1, until re-entered).

It looks like the problem is in FormulaParser.setParameterRVA(Node, int)
Commenting out the call to that method seems to fix this bug, but that is not a
proper solution.  Without that call, the token classes of all parsed formulas
will stay at 'reference', which is probably wrong for other formulas.

This functionality is related to the 'Token Class Transformation' section
(3.2.4) of excelfileformat.pdf.  This logic seems to be partially implemented
in POI but since there are no junits, it's probably not very stable yet.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44677] COUNTA function gives incorrect result

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44677


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Josh Micich <jo...@gildedtree.com>  2008-05-05 15:11:26 PST ---
Re-tested in 3.1-beta1.

This was probably fixed in bug 44675 (the parameter operand
class should be 'reference' instead of 'value')


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org