HomeGoogle DocsSpreadsheetPartial Match in VLOOKUP in Google Sheets

Partial Match in VLOOKUP in Google Sheets

Published on

The VLOOKUP function accepts wildcard characters in the search key. Therefore, achieving a partial match in VLOOKUP is straightforward in Google Sheets.

Some of you may already be familiar with using wildcards in Google Sheets functions. However, the importance of the partial match in VLOOKUP lies in your specific requirements:

  1. Whether you want to use the search key in a cell reference or hardcode it in the formula.
  2. Whether you require a case-sensitive partial match, where the wildcard won’t be utilized.

We will address both in this walkthrough guide with simple steps.

Partial Match in VLOOKUP Using Wildcard Characters

Let’s assume you have a small team of employees, each with a unique first name.

Your data contains employee names in column A (full names), their designations in column B, and attendance in the current month in column C.

Full NameDesignationAttendance
John SmithAccountant22
Alice JohnsonEngineer18
Michael BrownTeacher18
Emily DavisNurse22
David TaylorLawyer18

How do you look up their first names in column A and retrieve their attendance from column C?

This is where the relevance of partial match in VLOOKUP is apparent.

Syntax of the VLOOKUP Function in Google Sheets:

VLOOKUP(search_key, range, index, [is_sorted])

Example

The following VLOOKUP formula will partially match “Alice” in the range A2:C6 and return the value (attendance) from the third column.

=VLOOKUP("*Alice*", A2:C6, 3, FALSE) // returns 18

Remember, VLOOKUP searches the key in the first column of the range.

Alternatively, you can enter *Alice* in any cell, for example, cell E2, and use the formula as follows:

=VLOOKUP(E2, A2:C6, 3, FALSE)
Example of Partial Match in VLOOKUP in Google Sheets

Notes:

  • To search for names starting with “Alice”, you can use "Alice*".
  • To search for names ending with “Johnson”, you can use "*Johnson".
  • To search for a word that appears anywhere in the text, you can use "*text*". Replace “text” with the word you want to search for.

The above notes are applicable when you enter the search_key within the formula. When you prefer cell reference, enter the search_key in a cell without double quotes.

Case-Sensitive Partial Match in VLOOKUP

VLOOKUP is typically a case-insensitive function in Google Sheets, meaning that capital and small case letters don’t make any difference in the search.

However, case sensitivity in a partial match becomes crucial in VLOOKUP when the range contains text entries with different cases (uppercase and lowercase), such as product codes or identifiers.

How do you perform a case-sensitive partial match in VLOOKUP?

You can achieve this by virtually modifying the range using a combination of HSTACK and REGEXMATCH.

In the following example, let’s say we need to partially search the key “XYz” in the range A2:B5 and return the result from the second column. This requires a case-sensitive VLOOKUP.

Step-by-Step Instructions

  1. =ArrayFormula(REGEXMATCH(A2:A5, "XYz")) – This REGEXMATCH formula partially matches the key “XYz” and returns TRUE for matches and FALSE for mismatches.
    Partially match the search key in a column
  2. Use HSTACK to combine this range with the rest of the range in the table, which is B2:B5.
    =HSTACK(ArrayFormula(REGEXMATCH(A2:A5, "XYz")), B2:B5)
    Virtual range for case-sensitive partial match in VLOOKUP
  3. In this table, search for TRUE using VLOOKUP.
=VLOOKUP(
   TRUE, 
   HSTACK(ArrayFormula(REGEXMATCH(A2:A5, "XYz")), B2:B5), 
   2, 
   FALSE
)

This represents a case-sensitive partial match in VLOOKUP.

Notes:

  • REGEXMATCH(A2:A5, "XYz") – searches anywhere in the text.
  • REGEXMATCH(A2:A5, "^XYz") – matches strings starting with “XYZ”.
  • REGEXMATCH(A2:A5, "XYz$") – matches strings ending with “XYZ”.

Resources

Here are some related tutorials regarding partial matches in Google Sheets.

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.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

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.