Close Menu
Computing.net
    Facebook X (Twitter) Instagram
    Computing.netComputing.net
    • News
      1. AI
      2. Crypto
      3. Gaming
      4. Hardware
      5. Security
      6. Software
      7. View All

      Anthropic’s COBOL Automation Tool Triggers IBM Stock Plunge and Crypto Market Decline

      February 24, 2026

      AI Trading Bot Loses $441K in Crypto After Decimal Point Mistake

      February 23, 2026

      Tesla (TSLA) Stock: Goodbye Sedans, Hello Robots in Dramatic Production Shift

      January 29, 2026

      Palantir Technologies (PLTR) Stock: Why Bears May Be Wrong About Valuation Concerns

      January 29, 2026

      SUI Token Rallies 40% Following Major Staking Event and CME Futures Announcement

      May 12, 2026

      Chainlink (LINK) Surges to $10.40 as Network Activity Hits Eight-Month Peak

      May 12, 2026

      Dogecoin Whales Ramp Up Accumulation as DOGE Eyes Critical Breakout Levels

      May 12, 2026

      Bitcoin Holds $81K While Burry Flags Nasdaq Bubble and Oil Surges Past $105

      May 12, 2026

      Hamster Kombat: Unraveling TON’s Gaming Phenomenon

      August 7, 2024

      W-Coin: Exploring the Latest Telegram Tap-to-Earn Phenomenon

      August 7, 2024

      Hamster Kombat: 300 Million Players & Counting, HMSTR Token Airdrop Soon!

      July 31, 2024

      Hamster Kombat Developers Work with TON Team on Airdrop Solution

      July 30, 2024

      Nothing Expands Product Line with New AI Feature & Phone Update

      July 31, 2024

      Security Audit Reveals Concerns in Atari’s Blockchain Game on Base

      August 6, 2024

      SideWinder Group Targets Maritime Facilities in New Cyber Espionage Campaign

      July 30, 2024

      OAuth Implementation Flaw Exposes Millions of Websites to XSS Attacks

      July 30, 2024

      Hamster Kombat Players Face Growing Cybersecurity Threats

      July 25, 2024

      Anthropic’s COBOL Automation Tool Triggers IBM Stock Plunge and Crypto Market Decline

      February 24, 2026

      Cookie Crumble: Google Halts Plans to Eliminate Third-Party Cookies in Chrome

      July 23, 2024

      Big Brother is Watching: Apple’s Creepy New Ad Urges iPhone Users to Ditch Chrome

      July 23, 2024

      Nvidia Stock Soars to New Record at $219.44 Ahead of May 20 Earnings

      May 12, 2026

      Rocket Lab Shares Surge Past $120 Following Wave of Analyst Upgrades

      May 12, 2026

      GM Shares Decline Following 600 IT Layoffs Amid Strategic AI Workforce Transformation

      May 12, 2026

      SES Delivers €847M Q1 Performance as Intelsat Integration and Aviation Deals Fuel Expansion

      May 12, 2026
    • How To

      Batch Files: Tokens and Delimiters (FOR Loops)

      July 31, 2024

      Types of Ethernet Cabling & Electrical Low Voltage Wiring

      July 9, 2024

      What You Should Know About .JSON File Extension

      January 10, 2023

      Bkup File Extension

      November 19, 2022

      HEIC File Extension

      November 19, 2022
    • Office
      1. Excel
      2. Google Sheets
      3. View All

      How to Convert Column List to Comma Separated List in Excel

      July 24, 2024

      How to Find the Last Monday of the Month in Excel

      July 24, 2024

      Convert Bytes to MB or GB in Excel: 3 Methods!

      July 24, 2024

      How to Remove Characters from Right in Excel

      July 30, 2023

      How to Subtract in Google Sheets: Complete Guide

      July 31, 2024

      Bullet Points in Google Sheets

      January 20, 2022

      Sort by Date in Google Sheets

      January 18, 2022

      Google Sheets Timestamp

      January 17, 2022

      How to Subtract in Google Sheets: Complete Guide

      July 31, 2024

      How to Convert Column List to Comma Separated List in Excel

      July 24, 2024

      How to Find the Last Monday of the Month in Excel

      July 24, 2024

      Convert Bytes to MB or GB in Excel: 3 Methods!

      July 24, 2024
    • Answers
    • About
    • Contact
    Facebook X (Twitter)
    Computing.net
    Google Sheets

    VLOOKUP with Multiple Criteria in Google Sheets

    Constantin KioulafasBy Constantin KioulafasJanuary 7, 2022
    Twitter LinkedIn Email Telegram
    VLOOKUP with Multiple Criteria in Google Sheets
    Twitter LinkedIn Email Telegram

    One of the more common tasks in any spreadsheet application is searching through the data.

    Google sheets already comes with a very neat and powerful find option in the toolbar which searches for a keyword anywhere in the sheet.

    But there are times however, when you want to do something a bit more complex. Perhaps it’s a search that takes into account two or more columns at the same time.

    Or you want the search to return a piece of information related to the search term, such as looking up a name and receiving the corresponding email address.

    Oftentimes, you’ll also want to output the search results into a cell, or use them in a formula.

    To do all these, we’re going to be looking at a few handy Google sheets functions and using the following example sheet, which is a very simple mailing list.

    We want to be able to lookup a person’s name and have the sheet return the email address or company associated with that person.

    Ideally, we’d like it so that if we change the name to search for, the result also updates, automatically.

    As it turns out, Google sheets has a function called VLOOKUP (which stands for Vertical LOOKUP), that does exactly this.

    The following is taken from the Google Docs Editors Help definition for the function.

    VLOOKUP

    Vertical lookup. Searches down the first column of a range for a key and returns the value of a specified cell in the row found.

    Contents:

    Toggle
    • Sample Usage
    • Syntax
    • Sample Usage
    • Syntax
    • Sample Usage
    • Syntax

    Sample Usage

    VLOOKUP(10003, A2:B26, 2, FALSE)

    Syntax

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

    • search_key – The value to search for. For example, 42, “Cats”, or I24.
    • range – The range to consider for the search. The first column in the range is searched for the key specified in search_key.
    • index – The column index of the value to be returned, where the first column in range is numbered 1.
      • If index is not between 1 and the number of columns in range, #VALUE! is returned.
    • is_sorted – [TRUE by default] – Indicates whether the column to be searched (the first column of the specified range) is sorted. FALSE is recommended in most cases.
      • It’s recommended to set is_sorted to FALSE. If set to FALSE, an exact match is returned. If there are multiple matching values, the content of the cell corresponding to the first value found is returned, and #N/A is returned if no such value is found.
      • If is_sorted is TRUE or omitted, the nearest match (less than or equal to the search key) is returned. If all values in the search column are greater than the search key, #N/A is returned.

    We’ll begin with a simple example so that we can become familiar with how VLOOKUP works.

    At the bottom of our sheet, we’ve assigned cell C23 as the field where we can enter a name, and we want to have the company name printed in the the adjacent cell, D23.

    The formula required to do this is:
    =VLOOKUP(C23, C2:E20, 3, 0)

    Looking at the syntax for VLOOKUP, we see that the first parameter (which references cell C23), is the search key or value we are searching for.

    In our example, we’ve entered Joseph Degonia. This name appears in the seventh row of our mailing list, so we expect the formula to find a match.

    Next comes the range of cells encompassed by the search, C2:E20.

    The range can span across several columns and down any number of rows.

    The only restriction is that only the first column in the range is used in the search for the search key provided in the first parameter.

    In other words, our range starts from cell C2 and ends at cell E20, which would make column C the first column in the range.

    VLOOKUP will thus only look in column C to find a match against our search key (the name we enter in cell C23), which at the moment contains Joseph Degonia.

    The third parameter, which in our formula has a value of 3, tells VLOOKUP from which column to pull the results.

    Since our range spans from column C to column E (C2:E20), column C is considered the first column in the range, and therefore the 3rd column would be column E.

    The last parameter simply tells VLOOKUP whether the column on which the search is carried out is sorted or not.

    The resulting company name returned (in cell D23) is A R Packaging.

    Since the search on column C would have found a match in row 7 in the sheet, it then crosses over to the 3rd column in the range (column E) in the same row, and pulls out the result.

    That was a fairly straightforward search.

    Our next search is going to be a little bit more difficult, but not by much.

    The name to search for will be held in two cells, one holding the first name, the other the last name.

    This may not seem very practical in this particular situation, but as an exercise it does highlight how to build a search key that is a composite of more than one cell.

    The formula now becomes:
    =VLOOKUP(C24 & ” ” & D24, C2:E20, 3, 0)

    The only change is in the way we reference the search key or name, which is now a merger of cells C24 and D24.

    Cell C24 contains the first name, and D24 the last name.

    The first parameter to VLOOKUP changes from the single C23, to what is known as a concatenation of the cells C24 and D24, C24&” “&D24.

    The ampersand (&) is the concatenation operator and simply means add together the strings before and after the operator.

    In this case, to the contents of C24 is being appended the space character (enclosed in the double quotes “ “), to which in turn are being appended the contents of D24.

    We need to include a space, otherwise the resulting concatenation would produce JosephDegonia, and would never find a match, regardless of what names we entered.

    We now move on to a slightly more complex situation, in which the names in our mailing list are not in the one column, but are in two separate columns, first_name and last_name.

    Adapting the formula from before (to account for the change in column lettering after splitting the name into two columns), produces the error, Did not find value ‘Joseph Degonia’ in VLOOKUP evaluation.

    If you remember from earlier, VLOOKUP uses the first and only the first column defined in the range to do its search.

    But now, the first column only contains the first name. So how do we tell VLOOKUP to search through the merger of columns A and B?

    Not surprisingly, there is a function to do that as well, called ARRAYFORMULA.

    Again from Google Docs Editors Help, the definition for ARRAYFORMULA:

    ARRAYFORMULA

    Enables the display of values returned from an array formula into multiple rows and/or columns and the use of non-array functions with arrays.

    Sample Usage

    ARRAYFORMULA(SUM(IF(A1:A10>5, A1:A10, 0)))

    ARRAYFORMULA(A1:C1+A2:C2)

    Syntax

    ARRAYFORMULA(array_formula)

    • array_formula – A range, mathematical expression using one cell range or multiple ranges of the same size, or a function that returns a result greater than one cell.

    Let’s play around with ARRAYFORMULA to see just what it can do. We’ll proceed one step at a time.

    Here is our contact list and we’ve started by entering our first attempt at a formula in cell N2, that tries to merge the first and last name columns:

    =$A$2:$A$20 & ” ” & $B$2:$B$20

    It almost works, but it only merges a single name, whereas we want it to do this for the entire list of names.

    If we can achieve this, we can then use it as the VLOOKUP function’s second parameter.

    The problem lies in the fact that the formula returns a single name whereas we want the full range of names.

    The function ARRAYFORMULA comes to the rescue, and is capable of returning an array (or range) of values.

    What is called a range in a spreadsheet, is more commonly referred to as an array in programming, hence the function name.

    If we now wrap our formula inside the ARRAYFORMULA function, =ARRAYFORMULA($A$2:$A$20 & ” ” & $B$2:$B$20) we get the result shown in column N in the above screenshot.

    It has merged the first and last names (columns A and B) into a single array and displayed them in column N.

    While this is a step in the right direction, we are still not there. The range we pass to VLOOKUP also has to include columns C and D.

    So to the above formula, we need to also add those two columns.

    Since ARRAYFOMULA only takes one parameter, we need to use brackets (or curly braces) {}.

    Brackets allow you to group together values. When the values are separated by a comma, they are placed in adjacent columns.

    For example,  ={1, 2} would place the number 1 in the current cell and the number 2 in the cell to the right in the adjacent column.

    Applying this to our formula, we can now create a range that includes the merged first and last names, as well as the email and company_name columns.

    The formula to create the complete range now becomes:

    =ARRAYFORMULA({$A$2:$A$20 & ” ” & $B$2:$B$20, $C$2:$D$20})

    The brackets allow us to have our merged first and last names, as well as columns C and D, and the result is what we see in columns N – P in the snapshot above.

    We can now plug this into VLOOKUP as the second parameter, which defines the range of the lookup.

    The final and completed formula is as follows, and the result is shown in cell C24.

    =VLOOKUP(A24&” “&B24, ARRAYFORMULA({$A$2:$A$20&” “&$B$2:$B$20, $C$2:$D$20}), 3,0)

    As a bonus, I’m going to provide an alternative solution that uses the QUERY function.

    If you are familiar with SQL queries, then Google sheet’s QUERY will be easy to grasp.

    QUERY function

    Runs a Google Visualization API Query Language query across data.

    Sample Usage

    QUERY(A2:E6,”select avg(A) pivot B”)

    QUERY(A2:E6,F2,FALSE)

    Syntax

    QUERY(data, query, [headers])

    • data – The range of cells to perform the query on.
      • Each column of data can only hold boolean, numeric (including date/time types) or string values.
      • In case of mixed data types in a single column, the majority data type determines the data type of the column for query purposes. Minority data types are considered null values.
    • query – The query to perform, written in the Google Visualization API Query Language.
      • The value for query must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text.
      • See https://developers.google.com/chart/interactive/docs/querylanguage for further details on the query language.
    • headers – [ OPTIONAL ] – The number of header rows at the top of data. If omitted or set to -1, the value is guessed based on the content of data.

    The formula is as follows:

    =QUERY($A$2:$D$20, “SELECT D WHERE (A = ‘” & $A24 & “‘ AND B = ‘” & $B24 & “‘)”)

    The first parameter defines the range of cells with the data, while the second parameter contains the query statement, which is where we carry out our search.

    Let’s quickly analyze the query.

    • SELECT D : If a match is found, then it selects the result along the matching row from column D.
    • WHERE (….) : The where clause defines what conditions constitute a match. The first part of the clause checks to see if there’s a match in column A against the contents of cell A24. The second part checks to see if there’s a match in column B against the contents of cell B24. The AND signifies that both conditions must be met in order for a match to occur. The where clause equates to WHERE (A = ‘Joseph’ AND B = ‘Degonia’)

    The QUERY function can be a very powerful tool, especially if you are familiar with the Structured Query Language (SQL), otherwise there is a bit of a learning curve, but definitely worth the effort.

    If we compare the VLOOKUP formula with the QUERY formula, the QUERY formula is simpler, cleaner and more intuitive.

    Share. Twitter LinkedIn Email Telegram
    Avatar photo
    Constantin Kioulafas
    • LinkedIn

    Costas has a wide range of experience in Information Technology covering computer hardware, programming, telecommunications, networking, web services, and general IT support. He's worked in various roles such as PHP programmer and web developer, technical and desktop support, hardware repair, system administration. Costas has excellent background in Microsoft Windows and Office Suite (Excel, Word, Powerpoint, etc), as well as a thorough understanding of Networking and Hardware maintenance.

    Related Posts

    How to Subtract in Google Sheets: Complete Guide

    July 31, 2024

    How to Find the Last Monday of the Month in Excel

    July 24, 2024

    Convert Bytes to MB or GB in Excel: 3 Methods!

    July 24, 2024

    What is Information Technology? – Definition, Types, and Examples

    December 6, 2022

    How to Create a Box Plot in Microsoft Excel

    March 1, 2022

    How to Create Bar of Pie Chart in Excel

    March 1, 2022
    Add A Comment

    Comments are closed.

    Latest

    Nvidia Stock Soars to New Record at $219.44 Ahead of May 20 Earnings

    May 12, 2026

    Rocket Lab Shares Surge Past $120 Following Wave of Analyst Upgrades

    May 12, 2026

    GM Shares Decline Following 600 IT Layoffs Amid Strategic AI Workforce Transformation

    May 12, 2026

    SES Delivers €847M Q1 Performance as Intelsat Integration and Aviation Deals Fuel Expansion

    May 12, 2026

    Trump Dismisses Iran Peace Proposal — Oil Markets React as Hormuz Remains Restricted

    May 12, 2026
    • Facebook
    • Twitter

    Latest Reviews

    Meta Platforms Shares Tumble 8% Despite Strong Q1 Performance Amid AI Investment Surge

    April 30, 2026

    Flush.com Review: Casino & Sportsbook With 275% Welcome Bonus

    March 7, 2026

    Katsubet Review: Crypto Casino With 300% Welcome Bonus & Free Spins

    March 7, 2026

    7Bit Review: Crypto Casino With 325% Bonus & 250 FS

    March 7, 2026

    Mega Dice Review: Crypto Casino With 200% Bonus & 50 Free Spins, Legit?

    March 7, 2026


    Home / Privacy Policy / Terms & Conditions

    Computing.net © 1996 - 2026 Kooc Media Ltd. All rights reserved. Registered Company No.05695741

    Type above and press Enter to search. Press Esc to cancel.