Top Description Inners Constructors Methods
org.apache.poi.ss.formula.functions

public final Class Match

extends Var2or3ArgFunction
Class Inheritance
Imports
org.apache.poi.ss.formula.TwoDEval, org.apache.poi.ss.formula.eval.BlankEval, .ErrorEval, .EvaluationException, .MissingArgEval, .NumberEval, .NumericValueEval, .OperandResolver, .RefEval, .StringEval, .ValueEval, org.apache.poi.ss.formula.functions.LookupUtils.CompareResult, .LookupUtils.LookupValueComparer, .LookupUtils.ValueVector

Implementation for the MATCH() Excel function.

Syntax:
MATCH(lookup_value, lookup_array, match_type)

Returns a 1-based index specifying at what position in the lookup_array the specified lookup_value is found.

Specific matching behaviour can be modified with the optional match_type parameter.

match_type parameter description
ValueMatching Behaviour
1(default) find the largest value that is less than or equal to lookup_value. The lookup_array must be in ascending order*.
0find the first value that is exactly equal to lookup_value. The lookup_array can be in any order.
-1find the smallest value that is greater than or equal to lookup_value. The lookup_array must be in descending order*.
* Note regarding order - For the match_type cases that require the lookup_array to be ordered, MATCH() can produce incorrect results if this requirement is not met. Observed behaviour in Excel is to return the lowest index value for which every item after that index breaks the match rule.
The (ascending) sort order expected by MATCH() is:
numbers (low to high), strings (A to Z), boolean (FALSE to TRUE)
MATCH() ignores all elements in the lookup_array with a different type to the lookup_value. Type conversion of the lookup_array elements is never performed.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static LookupUtils.LookupValueComparer
createLookupComparer(ValueEval lookupValue, boolean matchExact)

private static ValueEval
eval(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, double match_type)

public ValueEval
public ValueEval
private static LookupUtils.ValueVector
private static double
evaluateMatchTypeArg(ValueEval arg, int srcCellRow, int srcCellCol)

private static int

Returns:

zero based index
findIndexOfValue
(ValueEval lookupValue, LookupUtils.ValueVector lookupRange, boolean matchExact, boolean findLargestLessThanOrEqual)

Inherited from org.apache.poi.ss.formula.functions.Var2or3ArgFunction:
evaluate

Constructor Detail

Matchback to summary
public Match()

Method Detail

createLookupComparerback to summary
private static LookupUtils.LookupValueComparer createLookupComparer(ValueEval lookupValue, boolean matchExact)
evalback to summary
private static ValueEval eval(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, double match_type)
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1)

Implements org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2)

Implements org.apache.poi.ss.formula.functions.Function3Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function3Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateLookupRangeback to summary
private static LookupUtils.ValueVector evaluateLookupRange(ValueEval eval) throws EvaluationException
evaluateMatchTypeArgback to summary
private static double evaluateMatchTypeArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException
findIndexOfValueback to summary
private static int findIndexOfValue(ValueEval lookupValue, LookupUtils.ValueVector lookupRange, boolean matchExact, boolean findLargestLessThanOrEqual) throws EvaluationException
Returns:int

zero based index

org.apache.poi.ss.formula.functions back to summary

private final Class Match.SingleValueVector

extends Object
implements ValueVector
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.formula.functions.LookupUtils.ValueVector

Field Summary

Modifier and TypeField and Description
private final ValueEval

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ValueEval
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_valueback to summary
private final ValueEval _value

Constructor Detail

SingleValueVectorback to summary
public SingleValueVector(ValueEval value)

Method Detail

getItemback to summary
public ValueEval getItem(int index)

Implements org.apache.poi.ss.formula.functions.LookupUtils.ValueVector.getItem.

Annotations
@Override
getSizeback to summary
public int getSize()

Implements org.apache.poi.ss.formula.functions.LookupUtils.ValueVector.getSize.

Annotations
@Override