row.createCell(1).setCellFormula("sales_1");
row.createCell(2).setCellFormula("sales_1*3");
//check that NamePtg refers to the correct NameRecord
Ptg[] ptgs1 = HSSFFormulaParser.parse("sales_1", wb, FormulaType.CELL, 0);
NamePtg nPtg1 = (NamePtg)ptgs1[0];
assertSame(nm1, wb.getNameAt(nPtg1.getIndex()));
Ptg[] ptgs2 = HSSFFormulaParser.parse("sales_1", wb, FormulaType.CELL, 1);
NamePtg nPtg2 = (NamePtg)ptgs2[0];
assertSame(nm2, wb.getNameAt(nPtg2.getIndex()));
//check that the formula evaluator returns the correct result
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue());
assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue());