Home
Categories
EXPLORE
True Crime
Comedy
Society & Culture
Business
Sports
History
News
About Us
Contact Us
Copyright
© 2024 PodJoint
00:00 / 00:00
Sign in

or

Don't have an account?
Sign up
Forgot password
https://is1-ssl.mzstatic.com/image/thumb/Podcasts116/v4/71/98/b7/7198b764-a15d-be86-66a4-c079855e789c/mza_12976570556437611399.png/600x600bb.jpg
Dear Analyst
KeyCuts
10 episodes
6 months ago
This is a podcast made by a lifelong analyst. I cover topics including Excel, data analysis, and tools for sharing data. In addition to data analysis topics, I may also cover topics related to software engineering and building applications. I also do a roundup of my favorite podcasts and episodes.
Show more...
Tech News
Education,
Technology,
News,
How To
RSS
All content for Dear Analyst is the property of KeyCuts and is served directly from their servers with no modification, redirects, or rehosting. The podcast is not affiliated with or endorsed by Podjoint in any way.
This is a podcast made by a lifelong analyst. I cover topics including Excel, data analysis, and tools for sharing data. In addition to data analysis topics, I may also cover topics related to software engineering and building applications. I also do a roundup of my favorite podcasts and episodes.
Show more...
Tech News
Education,
Technology,
News,
How To
https://is1-ssl.mzstatic.com/image/thumb/Podcasts116/v4/71/98/b7/7198b764-a15d-be86-66a4-c079855e789c/mza_12976570556437611399.png/600x600bb.jpg
Dear Analyst #133: Find or check if a cell contains text from a list of values or partial matching text in a list (3 methods)
Dear Analyst
32 minutes 1 second
11 months ago
Dear Analyst #133: Find or check if a cell contains text from a list of values or partial matching text in a list (3 methods)

There are times when a problem nags at you like a pebble in your shoe. Even when you're not working on the problem itself, you're thinking about the problem which make it even worse. Rarely do I come across a Google Sheets/Excel task I cannot solve with formulas, but this one evaded my extensive knowledge (or lack thereof). The reason why this problem kept on nagging at me was because it felt like it should be easy to do. Like it was something I've solved before in the past. Or a data manipulation task that should be easy to solve. Yet, when I tried building out the solution, I couldn't quite figure it out. Here's a quick graphic showing the data question at hand:







Breaking down the problem of checking if cell value contains text from another list



Seems simple, right? I have a bunch of sentences in column A and a bunch of words in column C. I want to know if the sentences in column A contain any of the words in column C.



I faced this task at work a few weeks ago and the kicker was not only did I need to figure out if the sentence contained the word, but also return another column from that "List to check" (imagine another list of values in column D in the screenshot above that I want to return). Immediately, I thought about different permutations of VLOOKUP and SEARCH but quickly realized on their own or combined, these formulas wouldn't to the trick.



If we break down the problem, what we really need to do is this:




* Loop through each color in column C



* Check to see if cell A2 contains any of the words in step #1



* If it does, great! Return a TRUE or another column from the lookup list



* Move to cell A3 and loop through all the colors again




Once we think through the steps involved, it starts to become a trickier problem. Again, I thought this problem would have a simple solution. It kept on nagging at me so I figured I should share the solution I came up with in this episode. The solution I'm showing below is in Google Sheets and the formulas are slightly different (actually easier) in Excel. Here's the Google Sheet with the 3 methods I came up with after doing some research. This episode is also a YouTube tutorial if you prefer seeing the solution:




https://youtu.be/bgsdDpZ3dTY




Method 1: Check if cell value contains text from list (partial match) and return TRUE or FALSE



This first method is actually the most important method to understand because it's building block for methods #2 and #3 where we want to return another column from the lookup list. This is the actual dummy data from the Google Sheet we'll be using to build out the formula for method #1:







The ten sentences all contain the first name of a character from the TV show The Fresh Prince of Bel Air (one of the all-time greatest TV shows, of course). There are a list of first names of each character in column F. Some sentences do not contain a character from the list in column F. In column B, the goal is to write a formula that returns a TRUE or FALSE if the sentence in column A contains one of the first names in cells F2:F8. If you want to jump straight to the answer, the formula you write in cell B2 is this:



=OR(ARRAYFORMULA(ISNUMBER(ARRAYFORMULA(SEARCH($F$2:$F$8,A2)))))



If you're using Excel (in Office 365), you can basically take out the ARRAYFORMULA in the formula or using CTRL+SHIFT+ENTER to enter the formula (if not using Office 365):


Dear Analyst
This is a podcast made by a lifelong analyst. I cover topics including Excel, data analysis, and tools for sharing data. In addition to data analysis topics, I may also cover topics related to software engineering and building applications. I also do a roundup of my favorite podcasts and episodes.