Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to calculate INDEX() function #64

Closed
balgf opened this issue Jan 2, 2017 · 6 comments
Closed

Fails to calculate INDEX() function #64

balgf opened this issue Jan 2, 2017 · 6 comments

Comments

@balgf
Copy link

balgf commented Jan 2, 2017

Sample formula:
=INDEX({"First","Second","Third","Fourth","Fifth","Sixth","Seventh"}, 4)

Errors thrown:
Undefined offset: 3 in /var/www/html/hoosh/excel_v2/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php on line 603
Undefined index: in /var/www/html/hoosh/excel_v2/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php on line 610

@balgf
Copy link
Author

balgf commented Jan 2, 2017

Turns out, $arrayValues passed to INDEX method is a 2 level array which is causing the issue.

array (size=1)
  0 => 
    array (size=7)
      0 => string 'First' (length=5)
      1 => string 'Second' (length=6)
      2 => string 'Third' (length=5)
      3 => string 'Fourth' (length=6)
      4 => string 'Fifth' (length=5)
      5 => string 'Sixth' (length=5)
      6 => string 'Seventh' (length=7)

@PowerKiKi
Copy link
Member

You are probably experiencing the same issue as PHPOffice/PHPExcel#1091. If you are able to provide a PR to solve it, that would very much appreciated.

@balgf
Copy link
Author

balgf commented Jan 5, 2017

It's different from that issue. I'll submit a report for that one coz it's still occurring in this package. Then, i'll drop a PR for fix on both issues.

balgf added a commit to balgf/PhpSpreadsheet that referenced this issue Jan 7, 2017
@balgf
Copy link
Author

balgf commented Jan 7, 2017

There appears to be a breakage when I pulled the latest dev copy. Not sure which commit caused this. Now the $arrayValues only recieved the last element. My fix no longer works because of this.

array (size=1)
  0 => string 'Seventh' (length=7)

@ankitm123
Copy link
Contributor

ankitm123 commented Mar 6, 2017

I will take a look, and understand the issue, and see if I can fix it

@stale
Copy link

stale bot commented Dec 4, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Dec 4, 2017
@stale stale bot closed this as completed Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants