php - Getting #N/A for any calculations that reference a cell by name
I have an Excel file that consists of 8 Worksheets.
Throughout the Excel file, there are calculations that take place in various cells that reference other cells in other worksheet and refer to them by name only.
For example in Worksheet 2, I have a cell D12 and the formula in this cell is=CostIssue
. CostIssue is a cell in Worksheet 1.
Using PHPExcel I managed to read the Excel file, manipulate some cells and then generate an HTML of it, but as I mentioned, in all the cells that reference named cells I am getting #N/A.
Any way to solve this or must I manually edit the entire file to reference these named cells in another way (i.e. by worksheet and cell number)?
Thanks
Update:
Some more info. Sheet 2, cell D12 contains=CostIssue
CostIssue is the name of cell C37 in Sheet 1 which contains:=VLOOKUP($C$9,$Params.$B$6:$D$10,2,0)
Answer
Solution:
I've been looking at this, using the Calc Engine debugging function, and am still unclear about the actual problem.
Using cell
D12
on worksheetExecutive Summary
which contains the formula=Input!C37
, and cellC37
on theInput
worksheet contains the formula=VLOOKUP($C$9,Params!$B$6:$D$10,2,FALSE)
which evaluates to0.5
(formatted as a percentage in the cells).With the debug code
I get the results
which is exactly what I would expect to see, with a correct result
Similarly, if I use the
toArray()
method, I'm getting50%
displayed in cell [12]['C']EDIT
Can you ensure that you're running the latest develop branch code for PHPExcel, because there have been a couple of fixes to the
VLOOKUP()
function since the last production release