GithubHelp home page GithubHelp logo

Comments (4)

PowerKiKi avatar PowerKiKi commented on July 18, 2024

Your help would be much appreciated to solve this. It would be great if you could create a unit test for it and propose a patch.

You could create new test data with a few cases, including yours, in a new file tests/data/Calculation/LookupRef/MATCH.php. And add the relevant methods in tests/PhpSpreadsheetTests/Calculation/LookupRefTest.php (mostly copy paste from existing code).

from phpspreadsheet.

agopaul avatar agopaul commented on July 18, 2024

The behavior of the function MATCH() when omitting the 3rd parameter should be:

"finds the largest value that is less than or equal to the lookup value. The values in the lookup array must be sorted in ascending order, i.e. from smallest to largest."

The thing is, your set is not ordered like the specs require, but apparently Excel, LibreOffice, etc don't complain if that rule is not respected.

Anyway, I'm looking into it and will provide a PR if I can reproduce the correct behavior (since I can't find any spec that covers this specific case).

from phpspreadsheet.

PowerKiKi avatar PowerKiKi commented on July 18, 2024

FYI in case you didn't stumble upon it yet, there is also the Google Docs documentation that talks about it. Unfortunately it does not seem to give much more info, but just in case...

from phpspreadsheet.

agopaul avatar agopaul commented on July 18, 2024

It turns out that the implementation of the MATCH function in Excel is quite weird when the mandatory order of the values is not respected, but I managed to "reverse-engineer" the underlying behavior.

from phpspreadsheet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.