IFERROR(...)

Category: Logical

Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula

IFERROR(value, value_if_error)

Category: Lookup and reference

Uses an index to choose a value from a reference or array

INDEX(array, row_num, [column_num])

Category: Statistical

Returns the k-th smallest value in a data set

SMALL(array, k)

Category: Logical

Specifies a logical test to perform

IF(Something is True, then do something, otherwise do something else)

Category: Information

Returns TRUE if the value is a number

ISNUMBER(value)

Category: Lookup and reference

Looks up values in a reference or array

MATCH(lookup_value, lookup_array, [match_type])

Category: Lookup and reference

Returns the row number of a reference

ROW([reference])

0

This formula matches the unique list with the second list and bring backs the respective row numbers. These row numbers are used as row indexes and feed to INDEX function to get the desired result. IFERROR is used to handle any error encountered in this process.