title: POI evaluate formula cell IllegalArgumentException
body: <p>Without FormulaEvaluator I can pass the formula to excel, but while retrieving the value from the formula cell gives me the null value (by using <code>cell.getRawValue()</code> ) .</p>
  
  <p>So I tried FormulaEvaluator API to evaluate formula.</p>
  
  <p>Here I used VLOOKUP formula in setFormula() method of XSSFCell, FormulaEvaluator evaluate(formulaCell) method throws <code>IllegalArgumentException</code>.</p>
  
  <p>Please help to set VLOOKUP formula and get the value after execution of formula.</p>
  
  <p>FYI, 
  I am using poi-3.9-20121203.jar</p>
  
  <p>Below is my code snippet and corresponding exception,</p>
  
  <pre><code>FileInputStream file = new FileInputStream(new File("D:\\Excel_Vlookup\\temp1.xlsx"));
  XSSFWorkbook  workbook = new XSSFWorkbook(file);
  XSSFSheet sheet = workbook.getSheetAt(0);
  FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
  XSSFCell formulaCell = null;
  CellValue cellValue = null;
  
  int count = sheet.getPhysicalNumberOfRows();
  
  for (int i = 1; i &lt; count; i++) {
  formulaCell = sheet.getRow(i).createCell(7);
  formulaCell.setCellFormula("VLOOKUP(B"+(i+1)+",'D:\\Excel_Vlookup\\[temp2.xlsx]Sheet1'!A:C,3,0)");
  cellValue = evaluator.evaluate(formulaCell);
  }
  file.close();
  </code></pre>
  
  <p>Got exception as below,</p>
  
  <pre><code>java.lang.IllegalArgumentException: Invalid sheetIndex: -1.
  at org.apache.poi.ss.formula.SheetRefEvaluator.&lt;init&gt;(SheetRefEvaluator.java:35)
  at org.apache.poi.ss.formula.OperationEvaluationContext.createExternSheetRefEvaluator(OperationEvaluationContext.java:97)
  at org.apache.poi.ss.formula.OperationEvaluationContext.getArea3DEval(OperationEvaluationContext.java:259)
  at org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForPtg(WorkbookEvaluator.java:576)
  at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:458)
  at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:279)
  at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:221)
  at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:257)
  at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluate(XSSFFormulaEvaluator.java:116)
  at com.cgi.MyExcelFormula.writeFormula(MyExcelFormula.java:31)
  at com.cgi.MyExcelFormula.main(MyExcelFormula.java:52)
  </code></pre>