Article Directory
1 Use of Lookup
The definition on the official website is as follows:
When you need to query a row or column and find the value at the same position in another row or column, one of the lookup and reference functions LOOKUP is used.
In general, the Lookup function is to complete the filtering and matching , and it can be divided into two types: numbers and strings:
- For a string, it can be simply regarded as a mapping , specifying a mapping, and the mapping corresponding to a known value can be found through loopup. The most direct example is a mapping between ID and Name. In the following example, there will be specific reflect
- For numbers, it is not just a standard single mapping, here it becomes a range . The mapping corresponding to the set number is valid for all values greater than the set number, unless the value reaches the range of another mapping. There are also specific instructions in the following example
Here are a few examples to show the corresponding role more clearly
-
Set the level corresponding to the score segment, and match the level corresponding to a list of scores
It can be found that the value of Lookup matching is the lower limit, which means that the scores of 0-60 are all mapped as fail; the scores of 60-80 are all mapped as passing; the scores of 80-90 are all mapped as good; the scores of 90-100 are all mapped For excellent
-
Find the inventory of the corresponding workpiece
Here is a simple mapping of the part number and its inventory
-
Find the Name corresponding to the artifact ID
The same is to make a simple mapping of the name of the part number
2 Use of VLOOKUP
VLOOKUP(lookup_value,table_array,col_index_num , range_lookup)
VLOOKUP (what you want to find, the location to find, the column number in the area containing the value to be returned, return approximate or exact match-expressed as 1/TRUE or 0/false)
Use an example to understand the meaning of the four parameters in VLOOKUP, as shown below:
The first parameter indicates the content to be searched, and the second parameter indicates the scope of the search . Both of these parameters are easier to understand. Mainly look at three or four parameters, and then look at the following two results:
It can be found that the third parameter seems to represent the first column in the search range. When the parameter is 1, the first column in the search range is matched. When the parameter is 2, the second column in the search range is matched. When the parameter is 3, return REF! , Because there are only two columns to find, for verification, add a column
The guess seems to have been verified, here the value of the fourth parameter is only 1/2, where 1 means exact match, 2 means fuzzy match, which is the built-in setting of the function
There is another problem that needs to be paid attention to. As can be seen from the figure below, it is impossible to match the area by number, because the search content must be in the leftmost column of the search area.
For more details, please refer to Vlookup
3 Use of HLOOKUP
vlookup is the judgment in the vertical direction, if it is the judgment in the horizontal direction, the Hlookup function can be used
4 Use of Index Match function
First look at the definition of the Index function:
index(array,row_num,column_num)
Returns the value of the cell corresponding to the desired row and column in a range
The first parameter array represents the data area we want to reference, the second parameter row_num represents the number of rows to be referenced, and the third parameter column_num represents the number of columns to be referenced.
Let's look at the definition of the Match function:
MATCH(lookup_value, lookup_array, match_type)
The content of the first parameter search, the second parameter data area, the third parameter search method (precise search/fuzzy search)
MATCH returns the position of the matched value in the lookup_array, not the value itself
5 Use of Match and vlookup
Let's talk about a simple example of the combination of match and vlookup to achieve value query
The original data is:
area | total amount | Number of deals |
---|---|---|
Shanghai | 81927 | 1234 |
Beijing | 291941 | 2031 |
Shenzhen | 121913 | 5768 |
- Use data verification
-
Write formula
match can return the column of the search data, and the column is the input parameter of vlookup
-
carry out