These examples will teach you how to Vlookup multiple criteria, return a specific instance or all matches, do dynamic Vlookup in multiple sheets, and more.
It is the second part of the series that will help you harness the power of Excel VLOOKUP. The examples imply that you know how this function works. If not, it stands to reason to start with the basic uses of VLOOKUP in Excel.
Before moving further, let me briefly remind you the syntax:
Now that everyone is on the same page, let's take a closer look at the advanced VLOOKUP formula examples:
How to Vlookup multiple criteria
The Excel VLOOKUP function is really helpful when it comes to searching across a database for a certain value. However, it lacks an important feature - its syntax allows for just one lookup value. But what if you want to look up with several conditions? There are a few different solutions for you to choose from.
Formula 1. VLOOKUP with two criteria
Suppose you have a list of orders and want to find the quantity based on 2 criteria, Customer name and Product. A complicating factor is that each customer ordered multiple products, as shown in the table below:
A usual VLOOKUP formula won't work in this situation because it returns the first found match based on a single lookup value that you specify.
To overcome this, you can add a helper column and concatenate the values from two lookup columns (Customer and Product) there. It is important that the helper column should be the leftmost column in the table array because it's where Excel VLOOKUP always searches for the lookup value.
So, add a column to the left of your table and copy the below formula across that column. This will populate the helper column with the values from columns B and C (the space character is concatenated in between for better readability):
=B2&" "&C2
And then, use a standard VLOOKUP formula and place both criteria in the lookup_value argument, separated with a space:
=VLOOKUP("Jeremy Sweets", A2:D11, 4, FALSE)
Or, input the criteria in separate cells (G1 and G2 in our case) and concatenate those cells:
=VLOOKUP(G1&" "&G2, A2:D11, 4, FALSE)
As we want to return a value from column D, which is fourth in the table array, we use 4 for col_index_num. The range_lookup argument is set to FALSE to Vlookup an exact match. The screenshot below shows the result:
In case your lookup table is in another sheet, include the sheet's name in your VLOOKUP formula. For example:
=VLOOKUP(G1&" "&G2, Orders!A2:D11, 4, FALSE)
Alternatively, create a named range for the lookup table (say, Orders) to make the formula easier-to-read:
=VLOOKUP(G1&" "&G2, Orders, 4, FALSE)
For more information, please see How to Vlookup from another sheet in Excel.
Note. For the formula to work correctly, the values in the helper column should be concatenated exactly the same way as in the lookup_value argument. For example, we used a space character to separate the criteria in both the helper column (B2&" "&C2) and VLOOKUP formula (G1&" "&G2).
Formula 2. Excel VLOOKUP with multiple conditions
In theory, you can use the above approach to Vlookup more than two criteria. However, there are a couple of caveats. Firstly, a lookup value is limited to 255 characters, and secondly, the worksheet's design may not allow adding a helper column.
Luckily, Microsoft Excel often provides more than one way to do the same thing. To Vlookup multiple criteria, you can use either an INDEX MATCH combination or the XLOOKUP function recently introduced in Office 365.
For example, to look up based on 3 different values (Date, Customer name and Product), use one of the following formulas:
=INDEX(D2:D11, MATCH(1, (G1=A2:A11) * (G2=B2:B11) * (G3=C2:C11), 0))
=XLOOKUP(1, (G1=A2:A11) * (G2=B2:B11) * (G3=C2:C11), D2:D11)
Where:
- G1 is criteria 1 (date)
- G2 is criteria 2 (customer name)
- G3 is criteria 3 (product)
- A2:A11 is lookup range 1 (dates)
- B2:B11 is lookup range 2 (customer names)
- C2:C11 is lookup range 3 (products)
- D2:D11 is the return range (quantity)
Note. In all versions except Excel 365, INDEX MATCH should be entered as an CSE array formula by pressing Ctrl + Shift + Enter. In Excel 365 that supports dynamic arrays it also works as a regular formula.
For the detailed explanation of the formulas, please see:
How to use VLOOKUP to get 2nd, 3rd or nth match
As you already know, Excel VLOOKUP can fetch only one matching value, more precisely, it returns the first found match. But what if there are several matches in your lookup array and you want to get the 2nd or 3rd instance? The task sounds quite intricate, but the solution does exist!
Formula 1. Vlookup Nth instance
Suppose you have customer names in one column, the products they purchased in another, and you are looking to find the 2nd or 3rd product bought by a given customer.
The simplest way is to add a helper column to the left of the table like we did in the first example. But this time, we will populate it with customer names and occurrence numbers like "John Doe1", "John Doe2", etc.
To get the occurrence, use the COUNTIF function with a mixed range reference (the first reference is absolute and the second is relative like $B$2:B2). Since the relative reference changes based on a position of the cell where the formula is copied, in row 3 it will become $B$2:B3, in row 4 - $B$2:B4, and so on.
Concatenated with the customer name (B2), the formula takes this form:
=B2&COUNTIF($B$2:B2, B2)
The above formula goes to A2, and then you copy it down to as many cells as needed.
After that, input the target name and occurrence number in separate cells (F1 and F2), and use the below formula to Vlookup a specific occurrence:
=VLOOKUP(F1&F2, A2:C11, 3, FALSE)
Formula 2. Vlookup 2nd occurrence
If you are looking for the 2nd instance of the lookup value, then you can do without the helper column. Instead, create the table array dynamically by using the INDIRECT function together with MATCH:
=VLOOKUP(E1, INDIRECT("A"&(MATCH(E1, A2:A11, 0)+2)&":B11"), 2, FALSE)
Where:
- E1 is the lookup value
- A2:A11 is the lookup range
- B11 is the last (bottom-right) cell of the lookup table
Please note that the above formula is written for a specific case where data cells in the lookup table begin in row 2. If your table is somewhere in the middle of the sheet, use this universal formula, where A1 is the top-left cell of the lookup table containing a column header:
=VLOOKUP(E1, INDIRECT("A"&(MATCH(E1, A2:A11, 0)+1+ROW(A1))&":B11"), 2, FALSE)
How this formula works
Here is the key part of the formula that creates a dynamic vlookup range:
INDIRECT("A"&(MATCH(E1, A2:A11, 0)+2)&":B11")
The MATCH function configured for exact match (0 in the last argument) compares the target name (E1) against the list of names (A2:A11) and returns the position of the first found match, which is 3 in our case. This number is going to be used as the starting row coordinate for the vlookup range, so we add 2 to it (+1 to exclude the first instance and +1 to exclude row 1 with the column headers). Alternatively, you can use 1+ROW(A1) to calculate the necessary adjustment automatically based on the position of the header row (A1 in our case).
As the result, we get the following text string, which INDIRECT converts to a range reference:
INDIRECT("A"&5&":B11") -> A5:B11
This range goes to the table_array argument of VLOOKUP forcing it to start searching in row 5, leaving out the first instance of the lookup value:
VLOOKUP(E1, A5:B11, 2, FALSE)
How to Vlookup and return multiple values in Excel
The Excel VLOOKUP function is designed to return just one match. Is there a way to Vlookup multiple instances? Yes, there is, though not an easy one. This requires a combined use of several functions such as INDEX, SMALL and ROW is an array formula.
For example, the below can find all occurrences of the lookup value F2 in the lookup range B2:B16 and return multiple matches from column C:
{=IFERROR(INDEX($C$2:$C$11, SMALL(IF($F$1=$B$2:$B$11, ROW($C$2:$C$11)-1,""), ROW()-1)),"")}
There are 2 ways to enter the formula in your worksheet:
- Type the formula in the first cell, press Ctrl + Shift + Enter, and then drag it down to a few more cells.
- Select several adjacent cells in a single column (F1:F11 in the screenshot below), type the formula and press Ctrl + Shift + Enter to complete it.
Either way, the number of cells in which you enter the formula should be equal to or larger than the maximum number of possible matches.
For the detailed explanation of the formula logic and more examples, please see How to VLOOKUP multiple values in Excel.
How to Vlookup in rows and columns (two-way lookup)
Two-way lookup (aka matrix lookup or 2-dimentional lookup) is a fancy word for looking up a value at the intersection of a certain row and column. There are a few different ways to do two-dimensional lookup in Excel, but since the focus of this tutorial is on the VLOOKUP function, we will naturally use it.
For this example, we'll take the below table with monthly sales and work out a VLOOKUP formula to retrieve the sales figure for a specific item in a given month.
With item names in A2:A9, month names in B1:F1, the target item in I1 and the target month in I2, the formula goes as follows:
=VLOOKUP(I1, A2:F9, MATCH(I2, A1:F1, 0), FALSE)
How this formula works
The core of the formula is the standard VLOOKUP function that searches for an exact match to the lookup value in I1. But since we do not know in which exactly column the sales for a specific month are, we cannot supply the column number directly to the col_index_num argument. To find that column, we use the following MATCH function:
MATCH(I2, A1:F1, 0)
Translated into English, the formula says: look up the I2 value in A1:F1 and return its relative position in the array. By supplying 0 to the 3rd argument, you instruct MATCH to find the value exactly equal to the lookup value (it's like using FALSE for the range_lookup argument of VLOOKUP).
Since Mar is in the 4th column in the lookup array, the MATCH function returns 4, which goes directly to the col_index_num argument of VLOOKUP:
VLOOKUP(I1, A2:F9, 4, FALSE)
Please pay attention that although the month names start in column B, we use A1:I1 for the lookup array. This is done in order for the number returned by MATCH to correspond to the column's position in table_array of VLOOKUP.
To learn more ways to perform matrix lookup in Excel, please see INDEX MATCH MATCH and other formulas for 2-dimensional lookup.
How to do multiple Vlookup in Excel (nested Vlookup)
Sometimes it may happen that your main table and lookup table do not have a single column in common, which prevents you from doing a Vlookup between two tables. However, there exists another table, which does not contain the information you are looking for but has one common column with the main table and another common column with the lookup table.
In below image illustrates the situation:
The goal is to copy prices to the main table based on Item IDs. The problem is that the table containing prices does not have the Item IDs, meaning we will have to do two Vlookups in one formula.
For the sake of convenience, let's create a couple of named ranges first:
- Lookup table 1 is named Products (D3:E10)
- Lookup table 2 is named Prices (G3:H10)
The tables can be in the same or different worksheets.
And now, we will perform the so-called double Vlookup, aka nested Vlookup.
First, make a VLOOKUP formula to find the product name in the Lookup table 1 (named Products) based on the item id (A3):
=VLOOKUP(A3, Products, 2, FALSE)
Next, put the above formula in the lookup_value argument of another VLOOKUP function to pull prices from Lookup table 2 (named Prices) based on the product name returned by the nested VLOOKUP:
=VLOOKUP(VLOOKUP(A3, Products, 2, FALSE), Prices, 2, FALSE)
The screenshot below shows our nested Vlookup formula in action:
How to Vlookup multiple sheets dynamically
Sometimes, you may have data in the same format split over several worksheets. And your aim is to pull data from a specific sheet depending on the key value in a given cell.
This may be easier to understand from an example. Let's say, you have a few regional sales reports in the same format, and you are looking to get the sales figures for a specific product in certain regions:
Like in the previous example, we start with defining a few names:
- Range A2:B5 in CA sheet is named CA_Sales.
- Range A2:B5 in FL sheet is named FL_Sales.
- Range A2:B5 in KS sheet is named KS_Sales.
As you can see, all the named ranges have a common part (Sales) and unique parts (CA, FL, KS). Please be sure to name your ranges in a similar manner as it's essential for the formula we are going to build.
Formula 1. INDIRECT VLOOKUP to dynamically pull data from different sheets
If your task is to retrieve data from multiple sheets, a VLOOKUP INDIRECT formula is the best solution – compact and easy-to-understand.
For this example, we organize the summary table in this way:
- Input the products of interest in A2 and A3. Those are our lookup values.
- Enter the unique parts of the named ranges in B1, C1 and D1.
And now, we concatenate the cell containing the unique part (B1) with the common part ("_Sales"), and feed the resulting string to INDIRECT:
INDIRECT(B$1&"_Sales")
The INDIRECT function transforms the string into a name that Excel can understand, and you put it in the table_array argument of VLOOKUP:
=VLOOKUP($A2, INDIRECT(B$1&"_Sales"), 2, FALSE)
The above formula goes to B2, and then you copy it down and to the right.
Please pay attention that, in the lookup value ($A2), we've locked the column coordinate with absolute cell reference so that the column remains fixed when the formula is copied to the right. In the B$1 reference, we locked the row because we want the column coordinate to change and supply an appropriate name part to INDIRECT depending on the column into which the formula is copied:
If your main table is organized differently, the lookup values in a row and unique parts of the range names in a column, then you should lock the row coordinate in the lookup value (B$1) and the column coordinate in the name parts ($A2):
=VLOOKUP(B$1, INDIRECT($A2&"_Sales"), 2, FALSE)
Formula 2. VLOOKUP and nested IFs to look up multiple sheets
In situation when you have just two or three lookup sheets, you can use a fairly simple VLOOKUP formula with nested IF functions to select the correct sheet based on the key value in a particular cell:
=VLOOKUP($A2, IF(B$1="CA", CA_Sales, IF(B$1="FL", FL_Sales, IF(B$1="KS", KS_Sales,""))), 2, FALSE)
Where $A2 is the lookup value (item name) and B$1 is the key value (state):
In this case, you do not necessarily need to define names and can use external references to refer to another sheet or workbook.
For more formula examples, please see How to VLOOKUP across multiple sheets in Excel.
That's how to use VLOOKUP in Excel. I thank you for reading and hope to see you on our blog next week!
Practice workbook for download
Advanced VLOOKUP formula examples (.xlsx file)
444 comments
hello i want to find age (how old as on date) in excel with year and months only, if days in a month is 15 or more , it round off to next month.
Hi! Why are you asking this question in an article about VLOOKUP? Try to use the recommendations described in this article: How to calculate age in Excel: from date of birth, between two dates.
Doesn't look like there is a solution to the following: I have a master list of agents. This list shows if they pick up or courier documents. However, the report I must check names against are in 2 different columns. Meaning there is a sell agent column and a buy agent column. I cannot combine the columns. So, I want to check Column 1 and return if the name is found - PU or Courier. If the name is not found, I want to check Column 2 and return PU or Courier. I have searched all over the web, and there is no solution to check 2 different columns and return information. Seems EXCEL should allow you to find this data via a formula solution. If anyone out there has a solution it would be a huge help to publish the steps. I am new to excel, and cannot do visual basic/code. I run this report daily, and right now I am printing the columns and manual checking the list, however there are more than 400 names. Help?
Hi! If I understand your task correctly, the answer to your question can be found in this article: VLOOKUP with IF statement in Excel.
IF(ISNA( VLOOKUP(…column1....)),IF(ISNA( VLOOKUP(…column2....)),"No","PU"),"PU")
I hope my advice will help you solve your task.
Hi there,
I tired this formula:
=INDEX('[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!$AI$9:$CM$28,MATCH(B7,'[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!$C$9:$C$28,0),MATCH('[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!$L$5&'[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!$AI$8,'[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!$L$5:$CM$5&'[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!$C$8:$CM$8,0))
for the below and just can't get it right.
I have two Excel sheets Construction Payroll Hrs 2023 & Payroll File 2023. In Payroll File 2023, I need the Breakdown section (OT 1.5, OT 2, Holidays, Bank Holidays, Sick Paid, Sick Unpaid) to be filled out based on the week number in B5. This information will be taking from the Construction Payroll Hrs 2023. So number of let's say overtime 1.5 hours will match the Employee ID as well as the specific week i.e. in week 18, employee ID 1 will have the following hrs: 4.5 in OT 1.5, 10 in OT 2, 8 in bank holiday etc. These numbers will change depending on the week. I hope it makes sense.
Would you be able to help me out? (I couldn't attach the sheets unfortunately).
Many thanks.
Lucie.
I used the below formula and it works for the very first cell but doesn't change with the date. Might be a starting point at least?
=(INDEX('[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!AI9:ME9,SMALL(IF('[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!L5:MI5=B5,ROW('[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!AI9:ME9)-MIN(ROW('[Construction Payroll Hrs 2023.xlsx]Construction - Payroll Hrs 2023'!AI9:ME9))+1),COLUMNS(B5:B5))))
It is very difficult to understand a formula that contains unique references to your workbook worksheets. Hence, I cannot check its work, sorry.
Hi, thank you for the reply. Apologies, let me explain.
I have two spreadsheets - one is called Construction - Payroll Hrs 2023 and the other one is called Payroll File 2023. The Payroll File 2023 needs to extract data from Construction - Payroll Hrs 2023.
I will adjust the column letters and numbers so it makes a bit more sense.
So let's say that in Construction - Payroll Hrs 2023 I have the following info:
- Employee ID: A5:A28, with the column heading in A4. Employee ID will always stay in column A.
- From column B, I will be inputting employee weekly hours, including overtimes, holidays, etc. This sheet is set up for the whole year so there
will be different amount of hours in every week. Week 1: Basic hours will be in B5:B28, with the column heading in B4. This will change in
week 2 where the basic hours will be in let's say column I (7 days / week therefore starts from 8th column) - I5:I28 with the heading in I4.
- Another important info in this sheet is the week number: the week number is placed two lines above the basic hours heading (this will also
change with the week) B2 for week 1 and I2 for week 2.
Because I can't have the two excel sheets together, I had to create the Payroll File 2023.
In this sheet, I have a dropdown list to specify the week I'm looking for: So let's say in B3 I have the dropdown to search for week 1, week 2, etc. Two lines under that, in B6 I will have Employee ID heading and it will list ID numbers from B7 down. In C6 I will have basic hours heading .
If in this sheet I select week 1, I need it to extract my basic hours etc. from the Construction - Payroll Hrs 2023 - so for week 1 it will take info from B5 to B28 and if I select week 2, it will take the info from I5:I28 etc.
So I need my basic hours in second sheet to change based on the dropdown (week) selection and Employee ID number.
I hope this makes a bit more sense?
Really appreciate your time. Thank you.
Hi! To dynamically change the range B2:B28 depending on the week number, use the OFFSET function. For example, B3 is a drop-down list with the week number.
=OFFSET('1'!B2:B28,0,('2'!B3-1)*7)
For more information, please visit: Excel OFFSET function - formula examples and uses.
I am trying to formulate cell B16 on sheet 1 to look up a value from a table with number ranges in sheet 6 based on data in cell B14 & B15 in sheet 1.
Please see below example for clarity on the query:-
B14: 12 (nominal diameter of a bolt)
B15: 1.75 (pitch)
B16:-needs to lookup up the nominal diameter firstly in sheet 6 between column A and B
- the value falls under a number range between two cells. E.g A18 is 11.2 and B18 is 22.4 - 12 falls in between
- Another lookup function will be needed for the value in B15 sheet 1 - to be matched with column C in sheet 6
- Once 12 and 1.75 have been matched - the value needed to be displayed in B16 will be displayed in column 4 in the table.
Which excel function would be most suitable to use in this scenario?
Hi!
To find the value between two numbers, you can use the formula INDEX MATCH. For more information, read: Excel INDEX MATCH with multiple criteria - formula examples.
=INDEX('6'!D2:D200,MATCH(1,('6'!A2:A200<=B14)*('6'!B20:B20>=B14),0))
Unfortunately, I could not understand the rest of your questions. If you explain, I will try to help.
I have a workbook with 10 different tabs each tab has a different supplier price list. I would like to create a quote tool on the first sheet were if you add the part number it will search all 10 tabs for the description and price. would you be able to assist with the formula
Hi! Here is the article that may be helpful to you: VLOOKUP across multiple sheets in Excel with examples.
I am trying to use value from C2 to look up the array from M2 to Q6 and return column O value. However, the C2 value falls between 2 values in the array. Microsoft Excel's default is to use the smaller value (e.g. if C2 = 38, The look up values in the array are 9, 15, 25, 37, and 50. Since C2 value is between 37 and 50 in the array, Excel returns the value for 37. I want it to return the higher value instead (that is 50 in this example). HOw can I write this VLookup?
The table looks like this and the value from C2 changes. we can have 38, 29, 19, 11
#(column M) Name Code
9 QB E12
15 TE E13
25 RB E14
37 WR E15
50 DE E16
Hi! Use an approximate search with INDEX MATCH and increase the number of the position that was found by 1.
Try the following formula:
=INDEX(O2:O6,MATCH(C2,M2:M6,1)+1)
For more information, please visit: INDEX & MATCH in Excel - better alternative to VLOOKUP.
I have two individual spreadsheets with an item number & and address on both. I will need to place a file # on the spreadsheet that does not have it. How ever when I do the Vlookup I receive an error. However the Item number repeats at every change of address.
for each single address I have 15 items number and I need the File # for each address and item number.
Please help :(
I am not sure I fully understand what you mean. To understand what you want to do, give an example of the source data and the desired result.
I have an excel sheet that i record the products that i sell. It has the following columns, i.e Quantity, price per unit,total sale, amount paid and outstanding amount. Quantity and price per unit i input manually. Total sale =Qty x price per unit. For payments received i use another excel sheet. How best can i merger payments from payments excel sheet to the column for amounts paid considering that payments are paid in instalments. How best can this be reconcilled without inputing them manually on the amount paid column, retrieving from payments column
Hello! To summarize the payments for each product, I recommend using the SUMIF function. See this manual for detailed instructions and examples: How to use SUMIF function in Excel with formula examples.
I have doubt in vlookup function how to select a "table array" as another cell data
like =VLOOKUP(D2,AA2,18,0)
D2 is the lookup value
AA2 is the lookup range
18,0) is [range_lookup]) cell of the lookup table
i have "table array" data in one cell.
Hi!
If you entered a table array in cell AA2, its values are written in a range of cells. For example, AA2:AB20. Use this range in the VLOOKUP formula.
Maybe this article will be helpful: Excel dynamic arrays, functions and formulas
Hi I need help.
Sheet 1 = employee data
Sheet 2 = leave request data from employees
Sheet 3 = leave tracker with employees id in rows and dates in rows.
I want to show in sheet 3 two things, either "plotted leave" or blank.
'Plotted" will show if the data is equal to the employee id and the leave requested, else it will show as blank.
Thanks for your help.
Hi!
I can't see your data, so I can't recommend a formula. To find the employee ID on Sheet2, use the MATCH function.
The formula could be something like this:
IF(ISNUMBER(MATCH(ID,.......)),"Plotted","")
I have 2 Excel files.
Excel 1 contains all the projects (raw data)
Excel 2 contains all the tasks created for projects in Excel 1
There are projects with multiple tasks created on them and I want to show all those tasks in one column
Is that possible?
Hello!
If you want to show in one column all tasks related to one project, use this guide: Vlookup multiple matches in Excel with one or more criteria.
If you want to show other data in several columns besides tasks, use the FILTER function. Read more: Excel FILTER function - dynamic filtering with formulas.
I hope my advice will help you solve your task.
I've read through these, but a bit lost on the best approach. I'm hoping two sheet vlookup might work.
sheet 1 has name and appointment date.
sheet 2 has name, appointment date, appointment status.
Sheet 2 will have multiple rows for the same name, and different appointment dates for that name.
i need to pull the appointment status in sheet 2 to match with the name and appointment date in sheets 1 and 2.
Any suggestions? Thanks in advance!
FJD
Hello!
Here is the article that may be helpful to you: VLOOKUP across multiple sheets in Excel with examples.
Thanks so much!
Hello I need some help with some excel formula with the data below:
Column A will have a list of names
column B will be that person's rest day
column F will have a list of dates (1 date per cell) for vacation
column H will have the name who made the request.
This is what I want to achieve, in Column C, this will tell if a person is on shift, rest day, or on vacation that day. Is this possible?
Thank you for your help.
Hello!
Use a nested IF formula on a column to display a value by multiple conditions.
If I understand your task correctly, try the following formula:
=IF(B1=TODAY(),"Rest", IF(F1=TODAY(),"Vacation","Shift"))
Hi, If you had Lemons sweet and lemons sour but wanted to return both using this example =INDEX(D2:D11, MATCH(1, (G1=A2:A11) * (G2=B2:B11) * (G3=C2:C11), 0))
I have changed G1 to "*Lemons*" but it is not working. How do i return a sum of Col D?
Hello!
If you want to find a partial match of text strings, use the SEARCH and ISNUMBER functions.
For example,
MATCH(TRUE,ISNUMBER(SEARCH(G1,A2:A11)),0)
I hope it’ll be helpful. If something is still unclear, please feel free to ask.
Price update Fruit Name Location Price
01-Jan-09 Semangka Jakarta 55555
01-Jan-09 Semangka Bogor 55556
01-Jan-09 Semangka Bandung 55557
01-Jan-10 Apel Jakarta 50000
01-Jan-10 Apel Bogor 60000
01-Jan-10 Apel Bandung 70000
01-Jan-11 Jeruk Jakarta 34343
01-Jan-11 Jeruk Bogor 44343
01-Jan-11 Jeruk Bandung 54343
01-Jun-16 Semangka Jakarta 88888
01-Jun-16 Semangka Bogor 88889
01-Jun-16 Semangka Bandung 88890
01-Jun-17 Apel Jakarta 65000
01-Jun-17 Apel Bogor 75000
01-Jun-17 Apel Bandung 85000
01-Jun-18 Jeruk Jakarta 67676
01-Jun-18 Jeruk Bogor 77676
01-Jun-18 Jeruk Bandung 87676
01-Jan-23 Apel Jakarta 125000
01-Jan-23 Apel Bogor 135000
How to use vlookup formula if i want to know the price of Apel Bogor at Oct 31th 2020?
Hi!
Read carefully the first paragraph of the article above.
how do i select the data filed highest of Wight and highest of Hight
weight Hight
1 0.0 148.3
2 0.0 242.8
3 0.0 123.2
4 0.0 135.5
5 0.0 124.2
6 64.1 72.1
7 84.6 105.6
8 115.4 77.4
9 128.2 77.7
The maximum values of Wight and Hight are in different lines. You can use the MAX function or the LARGE function.
=MAX(A1:A10)
=LARGE(B1:B10,1)
If this is not what you wanted, please describe the problem in more detail.
hi
i have SKU's customer name and sales to those customer for same SKU in multiple days in one month, Need to Vlookup SKU & Customer and get the total sales qty for each SKU for each customer
Hello,
looking for some guidance on a task I am struggling with.
I have to look up the content in coloumn B, based on the content of column A, but cannot seem to get it right.
My struggle is that I do not always get the desired match, as column B contains multiple matches for the text contained in col A, but I would like to return only matches that contain "%B2B%" (this being part of the text contained in column B).
Below an example of my data set:
A B
x ggg
x ggg
x fff-B2B
y ggg
y B2B-aaa
y B2B-aaa
My desired result would be that for the values that I have in column A, my result always displays the match in column B containing "B2B":
A = x ---> fff-B2B
A = y ---> B2B-aaa
I appreciate any suggestions or examples I may adapt to my case.
Thank you very much!
Hello!
To find a partial match between a text string and text, use the SEARCH function.
=INDEX(B1:B10,MATCH(1,--(A1:A10="X")*(--(ISNUMBER(SEARCH("B2B",B1:B10)))),0))
To get the found value by two criteria, use the INDEX+MATCH statement.
Hello Alexander,
thank you very much for your input!
I could solve the issue.
I have a sheet, where I wanted to match data in it if there are any discrepancies I wanted to Identify what are those.
The Sheets typically contains UserIDs in Column and its attributes in rest of the columns like department, first name and last name email address. This file will be manually entered into system by data entry analysts and now I have got the system export file, How can I Identify if there are any discrepancies.
Sheet1(input file for data entry) : UserID First Name Last Name Department Organization CostCenter OrgUnit
Sheet2 (system exported data) : UserID First Name Last Name Department Organization CostCenter OrgUnit
Typically I have rearranged all the columns and now I wanted verify whether the data entered in system is matching with original input file used by data entry analysts.
Hello!
The following tutorial should help: How to compare two Excel files or sheets for differences.
I'd recommend you to have a look at our Compare Sheets - our own tool to compare worksheets in Excel. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.
I have an Excel file with multiple columns. I'm trying to do multiple vlookups in one cell to check each column starting with column A for the SkU, column B and the next few columns up to G to return the total depth for that row (part number in column A) that is reflected In column H. All the part numbers in each column is linked to the part in column A, which are alternate part numbers. Any help anyone can offer will be greatly appreciated. I can send you my excel file, too.
Hello!
To do multiple-column searches, use a nested VLOOKUP as described in the article above. If you want to find all values in a range, try this instruction: Vlookup to return multiple results in one cell (comma or otherwise separated). I'd recommend you to have a look at our Vlookup Wizard. This tool is part of Ablebits Ultimate Suite that includes 70+ professional tools and 300+ solutions. You can install it in a trial mode and check how it works for free.
I'm trying to use xlookup with multiple criteria across several columns and ~15000 rows of data. The xlookup function returns a value for each row, but the data matches the return array row and not the criteria across columns. For example, data in row 100 in both my table and the return array (source) file is the same, even though the criteria is from row 90 (I don't need all 15,000 rows of data). Do you know why the formula is picking up the data in the row and not from the criteria related to the row?
Hi!
The XLOOKUP formula selects the data that you have specified in it.
In a MASTER sheet, I'm having SKU, fulfillment center, and Quantity. need to fetch quantity according to the matching of SKU and fulfillment center in another sheet. because the data of the master sheet will change every time.
Hi!
You can learn more about VLOOKUP with multiple criteria in this article above. If this is not what you wanted, please describe the problem in more detail.
Hello,
I am trying to put some data from baseball box scores into an Excel sheet. What I am trying to do specifically is bring in the pitchers for each team into a section of the sheet and then populate another area if a pitcher gets a certain stat (Win, Loss, Hold, Blown Save and Save).
Each game will have a pitcher get a Win or a Loss but the other three stats may or may not happen each game. The pitcher will be listed with a First Name and Last Name unless they get the certain stat and then the stat will be there along with either how many of the stat or their win-loss record. (Examples: John Smith or John Smith, W (4-3) or John Smith, L (3-4) or John Smith, H (17) or John Smith, BS (3) or John Smith, S (10))
Here is an example:
I put the stats in column A1:A5 (W L H BS S) as the lookup value for the stats.
The pitchers will be copied in column C - Visiting Pitchers in C1:C8 and Home Pitchers in C10:C17. These cells may not all be filled in each game.
What I want to do is look in both columns and find the stat looked up in column A and put the pitcher's name, stat and/or record from the examples I gave above in the cell that applies to the stat. So I want John Smith W (4-3) from the list to go in cell D1 for example for the winning pitcher. The cell for Win and Loss will each only have one result as well as Save. Hold and Blown Save can have more than one result and I can lost those in multiple cells.
I hope I have explained this well enough and I can provide more clarity if necessary.
Thanks for any help you can provide.
Hi!
This is a complex solution that cannot be found with a single formula. If you have a specific question about the operation of a function or formula, I will try to answer it.
Scenario:
Sheet 1 is having Names in Column 1 and Row1 is having the Dates.
Sheet 2 is having Names in Column 1 and Row1 is having Dates.
I need the formula to return the Dynamic index (Cell).
Ex: Sheet 1 If the Name and Date match with the Sheet 2 Name and date - Return the particular column values.
Hi!
Pay attention to the following paragraph of the article above – How to Vlookup in rows and columns (two-way lookup).
It covers your case completely.
Please help!! Been using Vlookup for a year already the same data over and over and got no N/A nor errors, but this fast weeks we've been experiencing NA. Absolutely sure that formula is correct, lookup_value and table_array references were made absolute correct. Still looking for what may have caused the N/A then correct data, the N/A again cycle goes on like this below: Thank you
#N/A
#N/A
MARIES
Karmelyn
Liza
Ely
Lara
#N/A
#N/A
#N/A
#N/A
Hi!
Please have a look at this article: Excel VLOOKUP not working - solving #N/A, #NAME, #VALUE errors.
First of all, pay attention to the leading and trailing spaces in your values.
HI!
I am struggling with a VLOOKUP and Im not sure why
I have a column of 18 fields C2:C18
Coulmn A is filled with roughly 3000+ fields, some of which match what is in the range C2:C18
Column B is filled with account numbers
How do I lookup the C2:C18 in column A and return the account number from column B that has a match?
Hello!
If I understand your task correctly, try the following formula:
=VLOOKUP(C2,A2:B3000,2,FALSE)
I recommend reading this guide: Excel VLOOKUP tutorial for beginners.
Hey!
I am looking to see if any of those 18 values from column C match anything in Column A and if they do to return the account number from Column B.
There might be multiple matches in Column C but a different account number that matches from B
That formula would only check column A for 1 of the 18 from Column C?
Hi!
I don't want to guess what you're looking for. Give an example of the source data and the expected result.
Charge (A) Acc number (B) Charge to look for (C)
XXX1234 Acc 1 CCC1234
AAA1234 Acc 2 PPP1234
BBB1234 Acc 3 SSS1234
CCC1234 Acc 4 EEE1234
DDD1234 Acc 5
EEE1234 Acc 6
FFF1234
GGG1234
HHH1234
III1234
So I am looking to search the entire of Column A for any result that matches the entire of Column C and return the account number from Column B that the charge is on. I hope that makes more sense, apologies!
=VLOOKUP(C2:C18,$A$2:$B$3111,2,0)
This is what I came up with but I'm getting an #N/A result for entire sheet, when i know that there are matches. Is there a limitation with VLOOKUPS when searching for multiple criteria in a table?
Hi!
Note that the VLOOKUP function can only look up one value. You want to search multiple values at once. To not display an error message, use the IFERROR & VLOOKUP function. Please read the VLOOKUP manual carefully.
=IFERROR(VLOOKUP(C2,$A$2:$B$3111,2,0),"")
Hello,
I am trying to write a formula that looks at three criteria and if all three criteria are met return a name.
I have the names in cells b17 through b36.
The first match I need is in cells e17 through e36. In these cells the number can be <= 2
The second criteria is in cells f17 through f36. In these cells the numbers can be 9.
If all three of these criteria falls within the range given, I need the result to be the name listed in cells b17 through b36
I have followed the match index but it’s not working for me.
If you can let me know if this can be done I am great full.
Thanking you in advance, Chuck Vaughan
Hi!
Please clarify your question. Should the condition be true for all cells in the range or just one of them? Is the result of the formula also a range of cells?
Great source of how to use Lookup functions.
Is there any way to make the lookup_array dynamic or a computed value (without using named ranges that are defined)? I've tried using the indirect function as you have but in the form of
=VLOOKUP(lookup_value,INDIRECT(B2)&":"&INDIRECT(D2), columnIndex, rangeLookup)
where B2 and D2 are the corner points of the desired array (in the form of $f$10 and $p$100)
array 1 $f$10:$p$100
array 2 $q$10:$aa$100
array 3 $ab$10:$al$100
etc...
Using defined named ranges creates additional workload and using a fixed lookup_array creates a massive array.
sorry, I was using the Indirect function incorrectly, but using the equation
=VLOOKUP(lookup_value, B2&":"&D2, columnIndex, rangeLookup)
just gives me a '#value' error because apparently B2&":"&D2 is evaluated as the string "$f$10:$p$100" and not the range $f$10:$p$100.
my apologies again, after some additional trial and error the following works - but thanks for your tutorial it definitely helped in solving my problem.
=VLOOKUP(lookup_value, INDIRECT(B2&":"&D2), columnIndex, rangeLookup)
Name/date 7/22 7/23 7/24
name1 65 55 22
name2 0 22 19
name3 2 59 0
Hi pls refer to the table I want to know when I select date I want to get cell values 1st highest to low then i need to get corresponded row value in front of that number
Say I Select 7/24
the result should be:
22 name1
19 name2
Hi!
The following tutorial should help: Excel INDEX MATCH MATCH and other formulas for two-way lookup.
Please try the following formulas:
=LARGE(INDEX(B2:E4,, MATCH(H2,B1:E1,0)),1)
=INDEX(A2:A4,MATCH(LARGE(INDEX(B2:E4,, MATCH(H2,B1:E1,0)),1), INDEX(B2:E4,, MATCH(H2,B1:E1,0)),0))
where H2 = "7/24"
The LARGE function with an argument of 1 specifies the highest value in the range. For the second value, change 1 to 2.
I hope it’ll be helpful.
2 sheets with addresses, trips sheet and jobs sheet. Trips is from fleet software tracking address of vehicle. Jobs sheet is job address and job data including job#. I need a column on trips sheet that looks to the job sheet addresses, finds the clise match and returns the job #.
Have tried vlookup and indexmatch.
Hello!
Have you tried the ways described in this blog post? It contains answers to your question. Also pay attention: Vlookup from another sheet.
I can't offer you a formula as I don't have your data.
Does the author issue any Email Seminars or thoughts? She is truly one of a kind - great Excel Seminars and would truly appreciate being advised of any & all seminars she might offer.
Thoughts?
Being researching Excel seminars for the last few decades & have found she is the leader - best
Thank you for your kind words, Waldo. I do not run any email seminars. You can find all my Excel articles on this blog.
I have inventory spreadsheet from month to month. The ending inventory of the previous month is the beginning inventory for the current month. Sample Formula for the current month =IF(ISNA(VLOOKUP(V2,Mar22!C:D,2,FALSE)<=0),0,(VLOOKUP(V2,Mar22!C:D,2,FALSE))). The formula works, however, I want the negative balance to show as "0" for the following month. Please help. Thank you
Hello!
Add one more condition to the formula with a nested IF function. I can't check the formula that contains unique references to your workbook worksheets.
=IF(ISNA(VLOOKUP(V2,'Mar22'!C:D,2,FALSE)),0, IF(VLOOKUP(V2,'Mar22'!C:D,2,FALSE)>0, VLOOKUP(V2,'Mar22'!C:D,2,FALSE),0))
Hello,
I am attempting to retrieve certain data using a unique identifier (123456), points from another sheet onto the main one I need the data on though there are multiple data points.
This the formula I am using but keep getting an error:
=VLOOKUP(A2,INDIRECT("A"&(MATCH(A2,Gradebook!$A$2:$F$2891,0)*ROW(Gradebook!A1:A2891))&":M2891"),6,FALSE)
One tab in the workbook is titled Main and these are the data points (below):
Student ID First Name Last Name Grade P1 Course P1 Mark P2 Course P2 Mark P3 Course
123456 Student Test 9
Which I am trying to pull the data points from tab titled, Gradebook, that contains the data points below
Student ID Student Name Course Periods Mark Perc
123456 Test, Student Literature 12 P1 C 72.33
123456 Test, Student Chemistry P2 F 57.28
123456 Test, Student Geometry P3 D 60.53
123456 Test, Student Theater P4 B- 80.25
123456 Test, Student Ethnic Studies P5 B- 80.35
123456 Test, Student Fitness P6 C+ 78.92
Which formula I can use, how can I pull the data points from Gradebook to paste onto the Main tab under each column?
Thank you!
Hello!
With an Excel formula, when you search by multiple criteria, you can extract only one value. For example, you can find the Mark value by the criteria Student ID, Course, Periods.
I recommend reading this guide: Excel INDEX MATCH to look up multiple criteria.
I hope my advice will help you solve your task.
=INDEX(Gradebook!$G$2:$G$2891,SMALL(IF($A2=Gradebook!$A$2:$M$2891,ROW(Gradebook!$A$2:$M$2891)-1,""),1))
I found this formula and it pulls the data I need but it is possible for it to pull data from a column based on data from another column?
For example:
Student ID 123456 has 3 columns of data
Column A: PE
Column B: Period 1
Column C: A+
How can I pull from any data point from Column A when column B contains specific text such Period 1, Period 2, etc?
Hi!
Sorry, it's not quite clear what you are trying to achieve.
I been working to recreate this seminar and have a few questions:
1)How to Vlookup and return multiple values in Excel - utilize INDEX, SMALL & ROW functions section Formula - {=IFERROR(INDEX($C$2:$C$11, SMALL(IF($F$1=$B$2:$B$11, ROW($C$2:$C$11)-1,""), ROW()-1)),"")}
If the cell containing this formula is C250 how does the above change? Should the "ROW()-1" become "ROW()-250? Can't get this to work
2)Name Range "Product" in one of your sections you state the range for Product as B2 It should shown as B2:B11
Thoughts?
Your seminars are one of the best if not THE BEST - many thanks Outstanding & very educational
Your Section - How to do multiple Vlookup in Excel (nested Vlookup) - 2 subanalysis to VLOOKUP 3rd file
Shows the "Products" range as D3:E3 believe it should be D3:E10
Shows the "Prices" range as G3:H3 believe this should be G3:H10
Thoughts?
Thanks
You are absolutely right, fixed. Thank you for pointing out that mistake!
Hi Waldo,
1) The generic formula is this:
IFERROR(INDEX(return_range, SMALL(IF(lookup_value = lookup_range, ROW(return_range ) - m ,""), ROW() - n )),"")
Where:
- m is the row number of the first cell in the return range minus 1.
- n is the row number of the first formula cell minus 1.
Assuming both the first cell in the return range and the first cell containing the formula are in row 250, you formula may look something like this:
=IFERROR(INDEX($B$250:$B$260, SMALL(IF(D$249=$A$250:$A$260, ROW($B$250:$B$260)-249,""), ROW()-249)),"")
For the detailed explanation, please see How to Vlookup multiple matches and return results in a column.
2) Can you please specify the section's name? Cannot find it.
I am trying to use this =VLOOKUP($A4,Data2!$A:$AC,H$1,FALSE) to pull forecast for multiple months from data file but this does seems to be working, could you please walk me through to use this formula appropriately ?
Hi!
Without seeing your data, I can't verify this formula.
I'm looking for a solution to work around using vlookup + vlookup
The data set is something like this:
10
20
31;32
40
The current idea is to insert enough columns to separate all items, then iferror(vlookup,,,),0) + iferror(vlookup,,,),0) + iferror(vlookup,,,),0) to sum all instances, or manually overwrite the single vlookup on the lines where multiple items are needed
Hello!
Sorry, I do not fully understand the task. Could you please describe it in more detail? What result do you want to get?
Hi. Can you please tell me what exactly do the following formulas yield. PLEASE!
=VLOOKUP(C2,M2:N180,2,0)
=VLOOKUP(C9,M:M,TRUE,FALSE)
Hello!
In this article, you can read the detailed description of the VLOOKUP function.
Hi There
i worked in logitics company where i need to to find Vlookup 1,2 and 3 occurence value that are in same column against in a order and want answer in column 1, 2 and 3 and then if blank choose other option kindly help me , to fix this
Hi!
I don't quite understand what you want to find. Explain with an example of your data.
I have an excel data like following, i want to Securitate only work completed line items in another work sheet, which formula we can use in VLOOKUP
SL.NO. QTN STATUS QTN REFE NO.
2 PENDING CS-QTN-06-21-0002
3 WORK COMPLETED CS-QTN-06-21-0003
4 REJECTED CS-QTN-06-21-0004
5 WORK COMPLETED CS-QTN-06-21-0006
6 WORK COMPLETED CS-QTN-06-21-0007
10 PENDING CS-QTN-06-21-0013
11 WORK COMPLETED CS-QTN-07-21-0005
17 PENDING CS-QTN-07-21-0017
18 PENDING CS-QTN-07-21-0018
Hi!
Sorry, it's not quite clear what you are trying to achieve.
HI Team
im using the below formula from vlookup-in first cell i entered fileExcel -3201
and i need to change each cell for example-3201,3202,3203.how to do it
find below for clarify
=VLOOKUP($B64,'C:\Users\Desktop\Excel 3201\[TOP BOTTOM KEY_16.12.2021_3801.xls]Report'!$A$14:$B$20,2,0)
Hello!
Here's how to get a link using the formula:
=INDIRECT("'"&B2&"["&A2&"]"&C2&"'!$A$14:$B$20")
A2 - file name (TOP BOTTOM KEY_16.12.2021_3801.xls)
B2 - File folder name (C:\Users\Desktop\Excel 3201\)
C2 - sheet name (Report)
In order for the link to work, the file must be opened, otherwise, you must use a VBA macro.
You can read more about using the INDIRECT function in an article on our blog.
Hi Svetlana,
I am new in Excel and I would like to use codes.
I would like to assign A=1, B=2, C=3, D=4, E=5, F=6, G=7, H=8, I=9, J=0.
if I would enter DJ, the value would be 40
If I would enter FCB, the value would be 632
Your help is appreciated.
Hi!
To change a letter to the corresponding digit, you can use the SUBSTITUTE function.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"C","3"),"B","2"),"A","1")
You can continue this formula with other letters and numbers.
Hi I'm try to make a vlookup with this information .
Category Indicates the category the item belongs to. Item categories are: “Bread & Bun”, “Cookie”, “Cake” and “Pastry”. Each ItemID beginning with the letter B belongs to the Bread & Bun category; those starting with K belongs to the Cookie category; those starting with C belongs to the Cake category; and those starting with Y belongs to the Pastry category.
Hi!
Where do you need help? Explain the problem.
Is there a way to perform a VLOOKUP and have it be case sensitive? For example, our ID's are 11384fMY15KIv and there may be one that is 11384FMY15KLv. Each one is different but the VLOOKUP function will return just one.
Hello!
You can learn more about case-sensitive VLOOKUP in Excel in this article on our blog.
Hi, I am curious to know what will be the formula be if we are looking for 3rd occurrence instead of 2nd occurrence?
Understand that from the formula shown above, +2 = +1 to exclude the first instance and +1 to exclude row 1 with the column headers
=VLOOKUP(E1, INDIRECT("A"&(MATCH(E1, A2:A11, 0)+2)&":B11"), 2, FALSE)
If the 3rd occurrence is 5 - 6 rows below 2nd occurrence, what will be the formula?
Hello!
This formula finds the third match in the VLOOKUP search:
=VLOOKUP(E1,INDIRECT("A"&(MATCH(E1, A2:A11, 0)+1 + MATCH(E1, INDIRECT("A"&(MATCH(E1, A2:A11, 0) +1+ROW(A1))&":A11"), 0)+ROW(A1))&":B11"), 2, FALSE)
hi this work in practise sheet and but able to help in real time solution
I wanted do vlookup in the main file from the different excel files. I need information in the one column in main file. I.e if booking pertains to CC then only CC files needs to be referred in Vlookup and similarly if booking pertains to other type then respective file should be referred for vlookup.
Hello,
I used the vlookup and it works but now i cant move the column to another excel. returns #REF!
please HELP ME!!
Hi!
If you use relative cell references in a formula, they change when you copy the formula. The formula doesn't work. Use absolute references. I recommend reading this guide: Relative and absolute cell reference: why use $ in Excel formula.
I hope it’ll be helpful.
I have been trying to use a vlookup in my spread sheet, but i cannot seem to get it to work correctly. Maybe i need something else?
Data columns on my data sheet are:
(A)Truck #, (B) Date, (C) Miles Driven and (D) Driver Name
What I need to do is:
look up the truck # by date and return the driver name
Any and add suggestions are greatly appreciated.
Hello!
Based on your description, it is hard to completely understand your task.
If you need to find the truck № by date, you can use INDEX + MATCH. Here is the article that may be helpful to you: INDEX MATCH formula to look up from right to left.
If you need to find the driver's name by date and truck number, I recommend using this guide.
I hope it’ll be helpful.
0
I don't know if this is even possible I am going to try to explain it the best I can, I don't know if the "IF" function is the correct thing to use here...
I want to Vlookup From a list in Column A but what I want to look up is dependent on what is in Column B
I don't know how to put this in a formula or even if you can:
If B3=R then =VLOOKUP(C3,Sheet1!$B:$R,11,false) If B2=L then =VLOOKUP(C3,Sheet2!$B:$R,11,false)
Is this possible? Any suggestions how to approach it, is there a better function that I don't know of yet? Thank you
Hello!
If I understood the problem correctly, please try this formula:
=IF(B3="R",VLOOKUP(C3,Sheet1!$B:$R,11,FALSE), IF(B2="L",VLOOKUP(C3,Sheet2!$B:$R,11,FALSE),""))
Here is the article that may be helpful to you: VLOOKUP with IF statement in Excel
THANK YOU! This worked! I was on the right track, saved me a few more hours of trial and error
Hey can u plz tell... is there any shortcut to go to the cells on which our vlookup function is dependent if those cells are in a different sheet.