I am getting a Java exception when trying to use Scott's hssf_formula()
wrapper to the POI classes to insert a SUMIF() function. Specifically, it
works when my cell references contain a single letter (such as A1) but fails
when a cell reference contains two letters (such as AA1). As an example,
this formula fails:
SUMIF(Invoices!Y:Y,F83,Invoices!AA:AA)
I have tried numerous variations on the cell reference, including with and
without $ qualifiers and with and without rows as well (eg $AA$1:$AA$100).
Anytime I only reference columns from A-Z it works, and anytime I reference
AA or beyond it fails with RNX0301:
Message . . . . : Java exception received when calling Java
method.
Cause . . . . . : RPG procedure HSSF_FORMU in program NATIVE/HSSFR4
received
Java exception "java.lang.IllegalArgumentException: Invalid Formula
cell
reference: 'AA'" when calling method "setC" with signature "" in
class
"org.apache.poi.hssf.usermodel.HSSFCell".
So it seems to not like my formula cell reference, but I can't find any
variation which works for columns beyond column Z. In testing, it seems it
works for SUM() but not for SUMIF() expressions. Is this just a bug in the
POI class which parses the SUMIF() arguments? I am not finding any web hits
for known problems with SUMIF in POI.
Any suggestions?
I would try using a named range instead, but HSSFName object class is not
implemented in Scott's service program, and the syntax for doing it myself
is not readily apparent.
Has anyone implemented range / cell names? I don't know if it will let me
circumvent my SUMIF() problem or not, but it is about the only syntax
variation left to try.
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.