-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Error with the Calculation of VLOOKUP cells #2934
Comments
Hey. Have the same issue. Part of exception message below :): |
oleibman
added a commit
to oleibman/PhpSpreadsheet
that referenced
this issue
Jul 13, 2022
Fix PHPOffice#2934. Null is passed to StringHelper::strtolower which expects string. Same problem appears to be applicable to HLOOKUP. I noted the following problem in the code, but will document it here as well. Excel's results are not consistent when a non-numeric string is passed as the third parameter. For example, if cell Z1 contains `xyz`, Excel will return a REF error for function `VLOOKUP(whatever,whatever,Z1)`, but it returns a VALUE error for function `VLOOKUP(whatever,whatever,"xyz")`. I don't think PhpSpreadsheet can match both behaviors. For now, it will return VALUE for both, with similar results for other errors. While studying the returned errors, I realized there is something that needs to be deprecated. `ExcelError::$errorCodes` is a public static array. This means that a user can change its value, which should not be allowed. It is replaced by a constant. Since the original is public, I think it needs to stay, but with a deprecation notice; users can reference and change it, but it will be unused in the rest of the code. I suppose this might be considered a break in functionality (that should not have been allowed in the first place).
7 tasks
oleibman
added a commit
that referenced
this issue
Jul 17, 2022
Fix #2934. Null is passed to StringHelper::strtolower which expects string. Same problem appears to be applicable to HLOOKUP. I noted the following problem in the code, but will document it here as well. Excel's results are not consistent when a non-numeric string is passed as the third parameter. For example, if cell Z1 contains `xyz`, Excel will return a REF error for function `VLOOKUP(whatever,whatever,Z1)`, but it returns a VALUE error for function `VLOOKUP(whatever,whatever,"xyz")`. I don't think PhpSpreadsheet can match both behaviors. For now, it will return VALUE for both, with similar results for other errors. While studying the returned errors, I realized there is something that needs to be deprecated. `ExcelError::$errorCodes` is a public static array. This means that a user can change its value, which should not be allowed. It is replaced by a constant. Since the original is public, I think it needs to stay, but with a deprecation notice; users can reference and change it, but it will be unused in the rest of the code. I suppose this might be considered a break in functionality (that should not have been allowed in the first place).
MarkBaker
added a commit
that referenced
this issue
Jul 18, 2022
### Added - Add Chart Axis Option textRotation [Issue #2705](#2705) [PR #2940](#2940) ### Changed - Nothing ### Deprecated - Nothing ### Removed - Nothing ### Fixed - Fix Encoding issue with Html reader (PHP 8.2 deprecation for mb_convert_encoding) [Issue #2942](#2942) [PR #2943](#2943) - Additional Chart fixes - Pie chart with part separated unwantedly [Issue #2506](#2506) [PR #2928](#2928) - Chart styling is lost on simple load / save process [Issue #1797](#1797) [Issue #2077](#2077) [PR #2930](#2930) - Can't create contour chart (surface 2d) [Issue #2931](#2931) [PR #2933](#2933) - VLOOKUP Breaks When Array Contains Null Cells [Issue #2934](#2934) [PR #2939](#2939)
I have same issue when I work with merge cell null value and luckily the bug was fixed ^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello 😄
This is:
What is the expected behavior?
VLOOKUP should find the cell and retrieve the value
What is the current behavior?
TypeError because of
strToLower
which happens because of an error of the evaluation of the formulaPHP Fatal error: Uncaught TypeError: PhpOffice\PhpSpreadsheet\Shared\StringHelper::strToLower(): Argument #1 ($textValue) must be of type string
What are the steps to reproduce?
Here is the file I use to test (It's a minimal version of it, showing the bug) :
doc2.xlsx
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
xlsx
Which versions of PhpSpreadsheet and PHP are affected?
1.24.0
What I did try to investigate :
If you remove the "FALSE" of
=VLOOKUP(B2;Sheet2!B:C;2;FALSE)
then it doesnt bug anymore.The text was updated successfully, but these errors were encountered: