Wuya Tutorial-JavaScript-MATCH Function

describe

The MATCH function searches for a specified item within a range of cells and returns the relative position of the item within the range.

Use MATCH instead of one of the LOOKUP functions when you need the position of an item in the scope rather than the item itself. like. You can use the MATCH function to provide a value for the row_num parameter of the INDEX function.

grammar

MATCH (lookup_value, lookup_array, [match_type])

debate

Argument describe Required/Optional
lookup_value

The value you want to match in the lookup_array. like. When you look up someone's number in the phone book, you use the person's name as the lookup value, but the pady number is the value you want.

The lookup_value parameter can be a value (number, text, or logical value) or a cell reference to a number, text, or logical value.

Required
lookup_array

The range of cells being searched.

Required
match_type

Number - 1, 0 or 1.

The match_type parameter specifies how Excel matches the lookup_value with the values ​​in the lookup_array.

The default value of this parameter is 1.

See below to learn how the function finds a value based on the match_type argument.

Optional
match_type What the match function will find
1 or omitted

MATCH finds the largest value less than or equal to lookup_value.

The values ​​in the lookup_array parameter must be placed in ascending order, such as:...-2,-1,0,1,2...AZ,FALSE,TRUE.

0

MATCH finds the first value that is exactly equal to lookup_value.

The values ​​in the lookup_array parameter can be in any order.

-1

MATCH finds the smallest value greater than or equal to lookup_value.

The values ​​in the lookup_array parameter must be arranged in descending order, such as: TRUE, FALSE, ZA...2, 1, 0,-1,-2...etc.

Notes

  • MATCH returns the position of the matching value in the lookup_array, not the value itself. like. MATCH(" b",{" a"," b"," c"},0) returns 2, which is the relative position of "b" in the array {" a"," b"," c"}

  • MATCH does not distinguish between uppercase and lowercase letters when matching text values.

  • If MATCH does not successfully find a match, a #N/A error value is returned.

  • If match_type is 0 and lookup_value is a text string, you can use wildcard characters in the lookup_value parameter - question mark (?) and asterisk (*)

    • question mark matches any single character

    • An asterisk matches any sequence of characters

    • If you want to find an actual question mark or asterisk, enter a tilde (~) before the character

  • Match Function returns wrong output if lookup_array is not sorted correctly

  • When the function fails to find a match for lookup_value, the matching function returns the error value #N/A. this can happen

    • If match_type=0 and no exact match to lookup_value is found in lookup_array

    • If match_type=1 or is omitted and the first value in lookup_array is greater than if match_type=1 lookup_value (i.e., the array is sorted in ascending order and there is no closest match below or equal to lookup_value).

    • If match_type=-1 and the first value in lookup_array is less than lookup_value (so if the array is in descending order, there is no closest match higher than or equal to lookup_value).

      p>
  • Whether there are invisible characters in the lookup_value or the values ​​in the lookup_array.

  • If the data in lookup_value and lookup_array have different data types.

applicability

Excel 2007,Excel 2010,Excel 2013,Excel 2016

Example

Match Function

MATCH function in JavaScript - Wuya Tutorial Network Wuya Tutorial Network provides a description. The MATCH function searches for the specified item within the cell range, and then returns the relative position of the item within the range. When... https://www.learnfk.com/javascript/advanced-excel-lookup-reference-match-function.html

Guess you like

Origin blog.csdn.net/w116858389/article/details/132914554