How to Perform Partial Match Between Two Columns in Google Sheets

There isn’t a single universal formula for performing a partial match between two columns in Google Sheets. The approach depends on the specific requirements. Let’s explore this with the following example data in columns A and B:

Description (Column A)Item (Column B)
Adjustable Standing DeskSteel
Stainless Steel Water BottleStainless Steel
Ortho ChairChair
Recliner SofaSofa
Wireless Bluetooth HeadphonesBluetooth
4K Ultra HD Smart TVUltra
Ergonomic Office Chair

Problem Scenarios

  1. Match the word “Steel” (the first item in column B) in column A and return the partially matching description.
  2. Match the phrase “Adjustable Standing Desk” (the first item in column A) with values in column B by identifying any word from the phrase and returning the corresponding values.

These scenarios require different formulas. Let’s go through the solutions step by step.

Find Partial Matches in Two Columns and Return Matching Items

To solve the first scenario, where you want to match the keyword in column B with descriptions in column A, use the following formula:

=TEXTJOIN(
   ", ", 
   TRUE, 
   IFNA(
      FILTER($A$2:$A, ISNUMBER(SEARCH(B2, $A$2:$A)))
   )
)

Enter this formula in cell C2 and drag it down to match all values in column B with the corresponding values in column A.

Find Partial Matches Between Two Columns and Return Results

Formula Breakdown:

  • SEARCH(B2, $A$2:$A): Finds the keyword in B2 within column A and returns a number (if found) or an error (if not found).
  • ISNUMBER(...): Converts results to TRUE for matches (numbers) and FALSE for mismatches (errors).
  • FILTER($A$2:$A, ISNUMBER(...)): Filters column A to include only the matching rows.
  • IFNA(...): Removes errors if no match is found.
  • TEXTJOIN(", ", TRUE, ...): Combines results into a single string, separated by commas.

Issue: This formula may return undesired matches for substrings (e.g., “and” matching “brand” or “ampersand”). For exact word matches, use the next formula.

Exact Word Matches in Google Sheets

Use this formula to ensure only exact word matches are returned:

=TEXTJOIN(
   ", ", 
   TRUE, 
   IFNA(
      FILTER($A$2:$A, REGEXMATCH($A$2:$A, "(?i)\b(" & B2 & ")\b"))
   )
)

Explanation:

  • REGEXMATCH($A$2:$A, "(?i)\b(" & B2 & ")\b"): Matches the exact word in B2 within column A (case-insensitive).
  • The rest of the formula components function similarly to the previous example.

Match Any Word from a Phrase in One Column with Another Column

To solve the second scenario, where you match any word from a phrase in column A with values in column B, use this formula:

=TEXTJOIN(
   ", ", 
   TRUE, 
   IFNA(
      FILTER($B$2:$B, REGEXMATCH($B$2:$B, "(?i)" & TEXTJOIN("|", TRUE, "\b(" & SPLIT(A2, " ") & ")\b")))
   )
)
Match Any Word from a Phrase in One Column to Another Column

Drag this formula down as needed to process multiple rows.

Explanation:

  • SPLIT(A2, " "): Splits the value in A2 into individual words.
  • "(?i)" & TEXTJOIN("|", TRUE, "\b(" & SPLIT(A2, " ") & ")\b"): Joins the words into a regular expression pattern for word matching.
  • REGEXMATCH($B$2:$B, ...): Matches any word from A2 in column B.
  • The rest of the formula works as described in previous examples.

Conclusion

We explored three formulas to handle different types of partial matches between two columns in Google Sheets:

  1. Basic partial match using SEARCH
  2. Exact word match using REGEXMATCH
  3. Matching any word from a phrase using SPLIT and REGEXMATCH

Choose the formula based on your specific requirements.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

How to Extract Numbers from Text in Excel with Regex

You can use the REGEXEXTRACT or REGEXREPLACE functions to easily extract numbers from text...

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

How to Use OFFSET and XMATCH Functions Together in Excel

We often use the OFFSET and XMATCH functions together to match a value in...

How to Calculate Maximum Drawdown in Excel and Google Sheets

You can use the following dynamic array formula to calculate maximum drawdown (MDD) in...

More like this

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

Running Count with Structured References in Google Sheets

Running a count with structured references is achievable in Google Sheets tables using the...

Running Total with Structured Table References in Google Sheets

You can use two types of formulas to create a running total with structured...

11 COMMENTS

  1. Hi,

    I want to have in C or any other column, a clean list of Column A filtered out with the text in B column.

    Thanks (my current method is making helper columns, copy, and paste, etc.)

  2. Hello. This formula seems to be exactly what I need. However, it is not capturing partial matches. So, if column A includes “orange” and B contains “orange juice” the response is “No”. My understanding is that it would be “Yes” because it does contain “orange”.

    =ArrayFormula(if(len(B2:B),if(COUNTIF(A2:A,"*"&B2:B&"*")>=1,"Yes","No"),))

    Also, would it match “oranges” which include “orange” within the larger plural word?

    Thank you!

      • Hello. Thank you for the quick response. Unfortunately, this does not work at all. Yours is the only website I’ve found that comes close to answering my question. I appreciate your help!

      • HI again. A friend came up with this. Works like a charm:

        =filter(Example!B2:B,regexmatch(Example!B2:B,textjoin("|",1,Example!A2:A))=FALSE)

        • Hi, Jason,

          Sorry! My answer was without seeing your data.

          Please do a search for the key “regexmatch” on this site. You can use the search icon on the top (navigation/menu bar).

          Cheers!

  3. Search for a Google Sheet add-on called Flookup. It’s patterned after VLOOKUP with a specific focus on fuzzy or approximate matching… and it’s free

  4. Hello.

    I sincerely appreciate your lectures. However, I am having a challenge with your formula in (A) above. I keep getting the error:#NAME?.

    The figures is more or less the same as in column D in the 2nd excel example above. Please, how do I fix this?

    Thanks

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.