VLookup
extends LookupBase
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- lookup() : mixed
- VLOOKUP The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
- checkMatch() : int|null
- evaluateArrayArguments() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
- evaluateArrayArgumentsIgnore() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
- evaluateArrayArgumentsSubset() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
- evaluateArrayArgumentsSubsetFrom() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
- evaluateSingleArgumentArray() : array<string|int, mixed>
- Handles array argument processing when the function accepts a single argument that can be an array argument.
- validateIndexLookup() : int
- validateLookupArray() : void
- initialiseHelper() : void
- testFalse() : bool
- vLookupSearch() : int|null
- vlookupSort() : int
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
lookup()
VLOOKUP The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
public
static lookup(mixed $lookupValue, mixed $lookupArray, mixed $indexNumber[, mixed $notExactMatch = true ]) : mixed
Parameters
- $lookupValue : mixed
-
The value that you want to match in lookup_array
- $lookupArray : mixed
-
The range of cells being searched
- $indexNumber : mixed
-
The column number in table_array from which the matching value must be returned. The first column is 1.
- $notExactMatch : mixed = true
-
determines if you are looking for an exact match based on lookup_value
Return values
mixed —The value of the found cell
checkMatch()
protected
static checkMatch(bool $bothNumeric, bool $bothNotNumeric, bool $notExactMatch, int $rowKey, string $cellDataLower, string $lookupLower, int|null $rowNumber) : int|null
Parameters
- $bothNumeric : bool
- $bothNotNumeric : bool
- $notExactMatch : bool
- $rowKey : int
- $cellDataLower : string
- $lookupLower : string
- $rowNumber : int|null
Return values
int|nullevaluateArrayArguments()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
protected
static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>
Example use for: ROUND() or DATE().
Parameters
- $method : callable
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsIgnore()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
protected
static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>
Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.
Parameters
- $method : callable
- $ignore : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubset()
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
protected
static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>
Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.
Parameters
- $method : callable
- $limit : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubsetFrom()
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
protected
static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>
Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.
Parameters
- $method : callable
- $start : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateSingleArgumentArray()
Handles array argument processing when the function accepts a single argument that can be an array argument.
protected
static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>
Example use for: DAYOFMONTH() or FACT().
Parameters
- $method : callable
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>validateIndexLookup()
protected
static validateIndexLookup(array<string|int, mixed> $lookup_array, float|int|string $index_number) : int
Parameters
- $lookup_array : array<string|int, mixed>
- $index_number : float|int|string
Return values
intvalidateLookupArray()
protected
static validateLookupArray(mixed $lookup_array) : void
Parameters
- $lookup_array : mixed
initialiseHelper()
private
static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
- $arguments : array<string|int, mixed>|false
-
Can be changed to array for Php8.1+
testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolvLookupSearch()
private
static vLookupSearch(mixed $lookupValue, array<string|int, mixed> $lookupArray, int|string $column, bool $notExactMatch) : int|null
Parameters
- $lookupValue : mixed
-
The value that you want to match in lookup_array
- $lookupArray : array<string|int, mixed>
- $column : int|string
- $notExactMatch : bool
Return values
int|nullvlookupSort()
private
static vlookupSort(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
- $a : array<string|int, mixed>
- $b : array<string|int, mixed>