kazor02x
kazor02x

Reputation: 43

Parsing a formula with java poi doen't work

I need to complete an excel with some data. But one cell in the sheet is a formula so I'm working with the parseformula gived by the poi library but I have some problems with the formula that I want to use:

=IF((E9*1,5+F9+G9*2/3) = 0;"";E9*1,5+F9+G9*2/3)

PS : all cells are in different lists

and the code is the following:

"IF(("+cellule_cm.get(ligne_excel)+"*1,5+"+cellule_td.get(ligne_excel)+"+"+
cellule_tp.get(ligne_excel)+"*2/3)=0;\"\";"+cellule_cm.get(ligne_excel)+"*1,5+"+cellule_td.get(ligne_excel)+"+"+cellule_tp.get(ligne_excel)+"*2/3)";

ligne_excel is the index of the line that i want to modify cellule_cm, cellule_td, cellule_tp are my list of cell

when i run it throw me the exception :

Parse error near char 23 ';' in specified formula 'IF((E9*1,5+F9+G9*2/3)=0;"";E9*1,5+F9+G9*2/3)'. Expected ',' or ')'

I don't understand why I can't parse Can you help me?

Upvotes: 0

Views: 5279

Answers (2)

IQV
IQV

Reputation: 500

According to the Apache POI-documentation POI only supports commas as separator for the arguments:

Section "The basics"

"Also note that only commas may be used to separate arguments, as per the Excel English style, alternate delimeters used in other localizations are not supported."

Upvotes: 4

Jeroen van Dijk-Jun
Jeroen van Dijk-Jun

Reputation: 1038

Not sure, but aren't you missing a '=' ?

  • IF((E9*1,5+F9+G9*2/3)=0;"";E9*1,5+F9+G9*2/3)
  • IF((E9*1,5+F9+G9*2/3)==0;"";E9*1,5+F9+G9*2/3)

Upvotes: 0

Related Questions