Locked lesson.
About this lesson
Use the UNIQUE function to return duplicate values from two lists.
Exercise files
Download this lesson’s related exercise files.
4.03 compare-lists-with-vlookup - Exercise.docx43.4 KB Exercise - Compare Lists with VLOOKUP.xlsx
13.6 KB 4.03 compare-lists-with-vlookup - Exercise solution.docx
95.2 KB Exercise Solution - Compare Lists with VLOOKUP.xlsx
15 KB 04-03-Compare Lists with VLOOKUP VSTACK and UNIQUE-Start.xlsx
14.3 KB 04-03-Compare Lists with VLOOKUP VSTACK and UNIQUE-Complete.xlsx
17.4 KB
Quick reference
Compare Lists with VLOOKUP, VSTACK, and UNIQUE
Learn how to compare lists using VLOOKUP and two new Excel functions, VSTACK and UNIQUE.
When to use
We can use VSTACK and UNIQUE to combine multiple lists together and extract the unique values. VLOOKUP allows us to compare lists and add error handling to make the results more meaningful.
Instructions
We are going to compare a list of Invitees with a list of Attendees to find out who was a no-show.
We want our formulas to be dynamic so we need to start by formatting both datasets as Excel tables.
- Click in the Invitees table.
- Press CTRL+T.
- Click OK.
- Click in the Attendees table.
- Press CTRL+T.
- Click OK.
Compare with VLOOKUP
We can compare two lists of data using the VLOOKUP function. VLOOKUP looks for a lookup value in a range of cells and returns a value from another column.
In this example, we are looking up the Invitee name [lookup_value], in the Attendees table [table_array], and we are returning the Attendee name in column 1 [col_index_num] if there is an exact match [range_lookup].
Wherever the formula returns an #NA error, those are the no-shows.
We can make this easier to read by adding error handling to the VLOOKUP formula so the #NA errors are replaced with meaningful text.
We can go a stage further and use Conditional Formatting to highlight all cells that contain the words 'No Show'.
Compare with VSTACK and UNIQUE
VSTACK and UNIQUE are two of the newer functions in Excel. UNIQUE is available for users of Excel for Microsoft 365, Excel 2019, and Excel 2021. VSTACK is only available to users of Excel for Microsoft 365.
The VSTACK function allows us to stack multiple arrays on top of each other. This is useful when we have two or more lists of data that we'd like to combine into one list.
The UNIQUE function is a versatile function that returns a list of unique values from a list and ignores duplicates.
In this example, we have two lists of employees who attended a two-day seminar. Some employees only attended one day, and some employees attended both days.
We want to send an email to all attendees but we don't want to send out duplicates to people who attended on both days.
To do this, we are going to combine both lists together and then extract a unique list of names.
Hints & tips
- VSTACK is currently being rolled out to Microsoft 365 users.
Lesson notes are only available for subscribers.