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:
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β
_______
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 >>β
_______
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<>"")
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?
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β
Get better at working with Google Sheets! Join 50,000 readers to get an actionable tip in your inbox every Monday.
Hi Reader, Welcome to the Google Sheets Tips newsletter #363, your Monday Tuesday* morning espresso, in spreadsheet form! (* arriving in your inbox on a Tuesday, because it was Columbus Day in the US yesterday.) Almost two years ago, I launched a course called "The AI Playbook for Google Sheets", which explored how to use basic AI inside Sheets. (Fun fact: this was my last course launch!) A lot has changed since then! Today, Gemini and other AI tools can manipulate data, generate formulas,...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #362, your Monday morning espresso, in spreadsheet form! Last week I finished recording and editing all the video lessons for the new Modern Google Sheets course (woohoo!). I keep track of progress in a Google Sheet (where else of course!) using Tables and dropdown chips: (click to enlarge) I'm using Tables extensively now in my Sheets work. I find the benefits over plain dataβsuch as the dropdown chips, table...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #361, your Monday morning espresso, in spreadsheet form! I'm excited to share today's tip with you. I came across it years ago but then forgot about it until today. And I'm kicking myself because it's so useful! I'm pretty sure I'll be using it on a daily basis now... read on to find out what it is. β News I.Last week, Google announced a significant enhancement to formula generation in Gemini for Sheets, making the...