profile
viewpoint

Ask questionsSVERVERWEIS cause Formula Error: An unexpected error occured

This is:

- [ x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

SVERVERWEIS Formula should work with $ in Matrix Parameter

What is the current behavior?

When i insert a SVERVERWEIS formula with the $ marker in the Matrix definition the getCalculatedValue() method throws an exception: Formula Error: An unexpected error occured

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

Create a empty excel sheet with Worksheet and Tabelle1 and the =SVERWEIS(E3;Tabelle1!$B:$D;3;FALSCH) formula.

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
        $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("../storage/app/template/test.xlsx");     
        $sheet = $spreadsheet->getSheetByName('Worksheet');
        $sheet->setCellValue('F5', 'Test');

        $writer = new Xlsx($spreadsheet);
        $writer->save('intermediate.xlsx');

// add code that show the issue here...

Which versions of PhpSpreadsheet and PHP are affected?

PHPOffice/PhpSpreadsheet

Answer questions p1ngb4ck

Could you provide an example of how to do this? This is some really bad issue for a lot of users => why do you close this instantly whithout any help?

Real world case is : Admin gets an excel sheet regularly by a 2nd company. There is no possible way to make the 2nd company work with en_us formulae. Admin needs to read in the file.

I fully understand, there needs to be a default to rely on. So of course en_us formulae format makes sense.

BUT :

Actually I see this as one of the most typical usecases (my real world case) for this library - could somebody PLEASE at least provide some sane example on how to do correctly use Calculation Engine locale settings? From my pov, Calc Engine should use the system-default locale setting - and at least try to use most common / known localized variants.

Edit : just verified, PHPSpreadSheet does exactly that. The hint from MarkBaker was just a too quick close, due to not realizing the real underlying bug.

When I debugged this in my usecase, I am right now verifying, this aint even the problem => the reference is being read as VLOOKUP internally .. the error is based on wrong interpretation of the matrix indeed. So closing this bug report was just a false quick shot

useful!
source:https://uonfu.com/
Github User Rank List