Bug 58353

Summary: MATCH function return wrong result with match_type == -1
Product: POI Reporter: Sergiy Nechyporchuk <nechyporchuk>
Component: SS CommonAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: regression CC: nechyporchuk
Priority: P2 Keywords: PatchAvailable
Version: 3.11-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Patch for fixing bug with match function

Description Sergiy Nechyporchuk 2015-09-10 11:51:39 UTC
Overview
If you call MATCH arguments with lookupValue less then any possible in the range and use SMALLEST_GTE match type then MATCH will return N/A instead of the smallest number in the range.

Steps to Reproduce
1) Create column with 3 cells:
  3
  2
  1

2) In any other cell enter formula:
  =MATCH(0.9, A1:A3, -1)

Actual Result
The result will be N/A.

Expected Result
The result should be 3

Build Date & Hardware
2015 Sep 10 & Ubuntu 14.04.3 LTS
Comment 1 Sergiy Nechyporchuk 2015-09-10 11:58:09 UTC
Created attachment 33089 [details]
Patch for fixing bug with match function
Comment 2 Dominik Stadler 2015-09-11 12:59:29 UTC
Can you maybe also add a unit test to class TestMatch which ensures that this stays fixed in the future?
Comment 3 Sergiy Nechyporchuk 2015-09-11 13:04:18 UTC
I've already added this to the patch file. This line in the TestMatch:

    confirmInt(5, invokeMatch(new NumberEval(3), ae, MATCH_SMALLEST_GTE));
Comment 4 Dominik Stadler 2015-09-11 18:52:49 UTC
Ah, sorry, I missed that. Applied via r1702535, thanks for the patch!