Bug 58353 - MATCH function return wrong result with match_type == -1
Summary: MATCH function return wrong result with match_type == -1
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 3.11-FINAL
Hardware: PC Linux
: P2 regression (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2015-09-10 11:51 UTC by Sergiy Nechyporchuk
Modified: 2015-09-11 18:52 UTC (History)
1 user (show)



Attachments
Patch for fixing bug with match function (1.51 KB, patch)
2015-09-10 11:58 UTC, Sergiy Nechyporchuk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!