Spot the Difference (How to Compare Lists, includes Template)



Hi Reader,

Welcome to the Google Sheets Tips newsletter #290, your Monday morning espresso, in spreadsheet form!

A big thank you to this week's sponsors who help keep this newsletter free to read:

DOKIN

Sync all your system data into Sheets, Slides, & Docs

Sync marketing, sales, and finance data into your Sheets. With Dokin, you can automatically sync data from 20+ apps into Google Workspace. Keep spreadsheets, documents, and presentations up to date with data from HubSpot, GA4, LinkedIn Ads, Salesforce, and more. Or use the writeback feature to edit system records directly from Sheets.

➜ New videos on YouTube

Check out my newest video tutorials on YouTube:

🎥 How to use the powerful MAP Function in Google Sheets​

🎥 How To Add Superscript And Subscript Characters in Google Sheets​

_______

➜ News

I.
​
The Explore feature in Google Sheets is disappearing at the end of the month. Not surprising since it was an old feature. I'm sure it's making way for a more powerful, native AI tool in Sheets in the future.

​Read more here >>​

II.
Bard
— Google's AI chat app — is now Gemini. This unifies Google's AI efforts around their new Gemini models, which are claimed to close the gap to ChatGPT's best models.

​Google AI updates >>​

_______

➜ Google Sheets Tip #290: Spot the Difference (How to Compare Lists)

In this tip, we look at a classic problem that everyone who works with data will face sooner or later: comparing 2 lists to find the differences.

For example, suppose we have these two lists of names in our Sheet that we want to compare:

Let's find out which names are in List 1 but not in List 2, and vice versa.

As with most spreadsheet problems, there are lots of ways you can do this.

Ten years ago, my go-to method for this was to use VLOOKUP to search for each name in the other list. (And if I was doing this today, I'd use an XLOOKUP instead.)

But today, I'll show you an alternative method using the COUNTIF function.

So we'll start by counting how many times each name in column A (List 1) appears in column E (List 2). Add this formula in cell B2 and drag it down to the bottom of your list:

=COUNTIF(E:E,A2)

This formula returns 0 if the name is missing. So let's add that as an equality test:

=COUNTIF(E:E,A2)=0

This gives a TRUE for missing names and FALSE otherwise. We could stop here and just look for the rows with TRUE to see the names that weren't in List 2.

But since we have a TRUE/FALSE we can wrap it with an IF function to make the output a little more user-friendly:

=IF(COUNTIF(E:E,A2)=0,"Not in list 2",)

For names not in List 2, the formula outputs "Not in List 2". For everything else, the row is left blank.

In the image above, we can see that "Michael Scott" was not found in List 2.

To generate a list of all the names missing from List 2, use a quick FILTER function:

=FILTER(A2:A,B2:B<>"")

Other way around

Follow the same steps with list 2 to find out which names on list 2 are missing from list 1.

This time, our range is column A (list 1), and our criterion, or search term, is column E (list 2). The first part of the formula is:

=COUNTIF(A:A,E2)

From here, follow the same steps previously mentioned to find the missing items.

And there we have it!

What do you think? What's your preferred way to compare lists?

Template

Make a copy of the template here, so you can see these formulas firsthand.

​🔗 Click here to open a view-only copy >>​

Feel free to make a copy: File > Make a copy…

_______

If you enjoyed this newsletter, please forward it to a friend who might enjoy it.

Have a great week!

Cheers,
Ben

P.S. Railway map of Antarctica​

Google Sheets Tips

Get better at working with Google Sheets! Join 50,000 readers to get an actionable tip in your inbox every Monday.

Read more from Google Sheets Tips
Add a QA check to prompts to make them more accurate

Hi Reader, Welcome to the Future Proof newsletter, your Monday morning espresso, in AI form! (Formerly the Google Sheets Tips newsletter.) One of the stories that jumped out to me in the past week came from an interview with a tearful Cornell mathematics professor, asking "what's the point?" when AI surpasses human ability and steals the meaning (and joy) from mathematical research. (Which is a calling, not just a job to many.) One line stuck with me, and I'm paraphrasing here, but basically,...

Add custom Gemini instructions in sidebar of Google Sheets

Hi Reader, Welcome to the Future Proof newsletter issue 5, your Monday morning espresso, in AI form! (Formerly the Google Sheets Tips newsletter.) Lots of Gemini and Google Workspace news to share today and a tip on custom instructions. Find it all below, but first a little anecdote from my weekend. Kids say the funniest things. My 9-year-old declared over the weekend that he was going to build his own AI company and call his AI tool "Psycho"! I laughed and told him I loved the name. I was...

Output Google Doc as markdown file

Hi Reader, Welcome to Future Proof #4 (formerly the Google Sheets Tips newsletter), your Monday morning espresso, in AI form! My son and I had some fun 3-D printing over the weekend. I printed a rugged case to hold my Field Notes journals (see the finished result at the end of this email). The print run just beginning. It's impressive to watch something grow from nothing, although since the full print took around 3 hours I didn't watch the whole thing ;) And now, perhaps more than ever...