xxxxxxxxxx
# Search keys in look-up table's rows in first column, returns the specified column's value if matched
= VLOOKUP(key, lookup table range, lookup table column number, approximate match)
# This looks up any row in A1:D100 dataset's A column where the value matches E5 value,
# then returns whatever that row's second column (B) contains
= VLOOKUP(E5, A1:D100, 2, FALSE) # FALSE means exact match, TRUE means approximate match
xxxxxxxxxx
Sub vlookup1()
Dim student_id As Long
Dim marks As Long
student_id = 11004
Set myrange = Range(“B4:D8”)
marks = Application.WorksheetFunction.VLookup(student_id, myrange, 3, False)
End Sub
xxxxxxxxxx
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])