You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Gaurav <gu...@gmail.com> on 2013/10/29 13:39:19 UTC

IllegalArgumentException while evaluating CONCATENATE formula

Hi Guys,

I have been struggling from last couple of days with following problem.
Problem: Apache POI is throwing an *IllegalArgumentException* while
evaluating CONCATENATE formula.
Whole formula looks like:

* =CONCATENATE("#DFLT=",COUNTIF(C5:C390,"=DEFAULTERS"),";
#NP=",COUNTIF(C5:C390,"=NOT PAID"),"; #PCsh=",COUNTIF(C5:C390,"=Paid
Cash"),"; #PChk=",COUNTIF(C5:C390,"=Paid Cheque"),";
#PNeft=",COUNTIF(C5:C390,"=Paid Neft"))*

I inputted text = "=Defaulters" in C5.
To verify whether this input works MSExcel i fed same input using MsExcel
and there formula was evaluated.

This input is only a sample input, exception is valid for all inputs.

Logcat result is as follows:
10-29 17:39:04.369: E/AndroidRuntime(28344): FATAL EXCEPTION: main
10-29 17:39:04.369: E/AndroidRuntime(28344):
java.lang.IllegalArgumentException: Unexpected eval class
(org.apache.poi.ss.formula.eval.MissingArgEval)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.eval.OperandResolver.coerceValueToString(OperandResolver.java:275)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.functions.TextFunction.evaluateStringArg(TextFunction.java:40)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.functions.TextFunction$8.evaluate(TextFunction.java:249)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:132)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:525)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:288)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:702)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.SheetRefEvaluator.getEvalForCell(SheetRefEvaluator.java:51)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.LazyAreaEval.getRelativeValue(LazyAreaEval.java:51)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.eval.AreaEvalBase.getValue(AreaEvalBase.java:109)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.functions.CountUtils.countMatchingCellsInArea(CountUtils.java:55)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.functions.Countif.countMatchingCellsInArea(Countif.java:451)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.functions.Countif.evaluate(Countif.java:440)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.functions.Fixed2ArgFunction.evaluate(Fixed2ArgFunction.java:33)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:132)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:525)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:288)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:230)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:354)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateInCell(HSSFFormulaEvaluator.java:243)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateInCell(HSSFFormulaEvaluator.java:46)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
com.android.impressico.readupdateexcelfile.ExcelFileWriter.writeCellToFile(ExcelFileWriter.java:122)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
com.android.impressico.readupdateexcelfile.ExcelFileWriter.writeToFile(ExcelFileWriter.java:27)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
com.android.impressico.readupdateexcelfile.MyPOIManager.manage(MyPOIManager.java:46)
10-29 17:39:04.369: E/AndroidRuntime(28344): 	at
com.android.impressico.readupdateexcelfile.MyPOIManager.main(MyPOIManager.java:18)




--
View this message in context: http://apache-poi.1045710.n5.nabble.com/IllegalArgumentException-while-evaluating-CONCATENATE-formula-tp5714082.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: IllegalArgumentException while evaluating CONCATENATE formula

Posted by Gaurav <gu...@gmail.com>.
I am using Apache 3.9 stable version.
I have tried same code on 3.10 Beta also, but there also i am getting the
same exception. 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/IllegalArgumentException-while-evaluating-CONCATENATE-formula-tp5714082p5714084.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: IllegalArgumentException while evaluating CONCATENATE formula

Posted by Nick Burch <ap...@gagravarr.org>.
On Tue, 29 Oct 2013, Gaurav wrote:
> Problem: Apache POI is throwing an *IllegalArgumentException* while
> evaluating CONCATENATE formula.
> Whole formula looks like:
>
> * =CONCATENATE("#DFLT=",COUNTIF(C5:C390,"=DEFAULTERS"),";
> #NP=",COUNTIF(C5:C390,"=NOT PAID"),"; #PCsh=",COUNTIF(C5:C390,"=Paid
> Cash"),"; #PChk=",COUNTIF(C5:C390,"=Paid Cheque"),";
> #PNeft=",COUNTIF(C5:C390,"=Paid Neft"))*

What version of Apache POI are you using? And if it isn't the latest one 
(3.10 beta 2), can you try upgrading to see if it's an already-fixed 
problem?

Nick

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