0

I have a cell in an excel sheet that i am trying to read. When I use the function getCalculatedValue it's throwing following error:

Financials!LU83 -> Financials!LU81 -> Formula Error: An unexpected error occured

I wrote following function to read from a cell

private function getCellValue($data)
{

        //example of data variable
        //$data = [0, 'G79'];

        $excel = $this->excel;
        $excel->setActiveSheetIndex($data[0]);
        \PHPExcel_Calculation::getInstance($excel)->flushInstance();
        \PHPExcel_Calculation::getInstance($excel)->clearCalculationCache();
        return $excel->getActiveSheet()->getCell($data[1])->getCalculatedValue();

    }

that cell that I am trying to read has following value

=LU83+LT84

where LU83 has following value

=LU73-SUM(LU76:LU81)

LU81 has value

=VLOOKUP(LU8,'Wiser Return'!$O:$S,5,0)

I have no idea why I am getting this error. I wish there was a way to debug? Is there a way?

Any help is appreciated.

Thanks

4
  • 1
    Possible duplicate of PHPEXCEL getCalculatedValue or getFormattedValue returns fatal error Commented May 3, 2017 at 6:56
  • So what does cell LU81 contain? That's the cell that it's complaining about Commented May 3, 2017 at 7:14
  • =VLOOKUP(LU8,'Wiser Return'!$O:$S,5,0) Commented May 3, 2017 at 7:20
  • I will look at that post and update my code, I will update this thread as soon as I do Commented May 3, 2017 at 7:22

2 Answers 2

1

The problem is that PHPExcel's calculation engine does not fully support row or column ranges.

=VLOOKUP(LU8,'Wiser Return'!$O:$S,5,0) 

contains the column range $O:$S

If this can be converted to a cell range instead, e.g

=VLOOKUP(LU8,'Wiser Return'!$O1:$S1024,5,0) 

then it should handle the formula correctly

Sign up to request clarification or add additional context in comments.

Comments

0

I can't comment now, but I found some link that might help you.

In this question the accepted answer states, that you can get further information about the error with this gist.

(I suggest deleting your question if this helped you.)

1 Comment

ok, I will read that post and try it in my code and delete this topic if it solved it thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.