The “Match” function in Microsoft Excel VBA (Visual Basic for Applications) procedures finds a match within a range of cells and prints it to the spreadsheet. The function is useful when entering data that needs to be evaluated for certain values. For instance, if you have a spreadsheet filled with sales numbers, the match function can be used to find sales that were below a certain numeric threshold. The function can be used anywhere on the Excel spreadsheet and only takes one line of code in a cell. Column A——–Column B Monday———–>$150.00 Tuesday———->$90.00 Wednesday—–>$200.00 Match ( my_lookup_value, my_lookup_array , [my_match_type] ) The “my_lookup_value” is the value you want to find in the range specified in “my_lookup_array.” “My_match_type” is one of three values. Using “0” for this value finds an exact match. Using number “1” triggers the function to find the closest match that is less than the given number. Conversely, number “2” triggers the function to find the closest match that is greater than the given look-up value. =Match (100, B1:B3, 1 ) Notice the equals sign. This is necessary so Excel knows the text entered is a function and not literal.

How to Use the Match Function in VBA - 97