## How to use VLOOKUP with multiple conditions

I will in this article demonstrate how to use the VLOOKUP function with multiple conditions. The function was not built for these circumstances, however, I will demonstrate a few workarounds and also explain how they work.

There is a file for you to get at the very end of this article.

#### Table of Contents

- VLOOKUP function with two conditions applied to two columns (AND logic)?
- VLOOKUP function with two conditions applied to two columns (OR logic)?
- VLOOKUP function with many conditions applied to one column (OR logic)?
- Can we use VLOOKUP with multiple lookup values?
- VLOOKUP across multiple columns?
- Can you concatenate VLOOKUP results?
- How to use VLOOKUP with dates?
- What if I don't have the lookup column in the left-most column?
- VLOOKUP - Select column using a drop-down list
- Why do I want to convert the data set to an Excel Table?

### How to use the VLOOKUP function with two conditions (AND logic)?

The image above shows a data set in cell range B2:F12, the VLOOKUP function in cell D16 looks for both a value in column B and another value in column C. If both values match a third value on the same row is retrieved from column D and shown in cell D17.

AND logic means that the VLOOKUP function retrieves only if both conditions match.

#### Can you combine the IF function and the VLOOKUP function?

Yes, you can, in fact, it is the easiest way to VLOOKUP using two or more conditions.

Array formula in D17:

To enter an array formula press and hold CTRL + SHIFT simultaneously, then press Enter once. Release all keys.

The formula bar now shows the formula enclosed with curly brackets telling you that you entered the formula successfully. Don't enter the curly brackets yourself.

### Explaining formula in cell D17

I recommend you use the "Evaluate Formula" feature in Excel to examine calculations step by step.

Select cell D17, go to tab "Formulas" on the ribbon and press with left mouse button on the "Evaluate Formula" button.

(*The formula shown in the above image is not the formula used in this article.*)

Press with left mouse button on "Evaluate" button to see the next step in the formula calculations.

#### Step 1 - Filter records

The IF function filters records that match the value in cell D15, all remaining records are blank. The IF function has three arguments: IF(*logical_test*, [*value_if_true*], [*value_if_false*])

The logical_test argument is C3:C12=D15, it checks if the values in column C are equal to the condition in cell D15. TRUE is returned if it is equal and FALSE if not equal.

IF(C3:C12=D15, B3:F12, "")

becomes

IF({"Australia"; "North America"; "Asia"; "Europe"; "South America"; "Australia"; "North America"; "Asia"; "Europe"; "South America"}="South America", B3:F12, "")

becomes

IF({FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; TRUE}, B3:F12, "")

If a value in the array is TRUE the corresponding values in B3:F12 are returned and FALSE returns a blank row.

IF({FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; TRUE}, B3:F12, "")

becomes

IF({FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; TRUE},{"A","Australia","Atlantic Corporation","Birdie","Schneider"; "B","North America","Uplink Corporation","Amshula","Canty"; "C","Asia","Omni Consumer Products","Jaycee","Martin"; "D","Europe","Galaxy Corp","Tracy","Tuck"; "A","South America","The New Firm","Tory","Byrnes"; "B","Australia","ZiffCorp","Santos","Cowart"; "C","North America","Minuteman Cafe","Gen","Lindgren"; "D","Asia","Demo Company","Edwin","Shinn"; "E","Europe","Western Gas & Electric","Allayna","Egan"; "F","South America","Trans United Airways","Ervin","Hennessey"}, "")

and returns

{"","","","","";"","","","","";"","","","","";"","","","","";"A","South America","The New Firm","Tory","Byrnes";"","","","","";"","","","","";"","","","","";"","","","","";"F","South America","Trans United Airways","Ervin","Hennessey"}

This array has commas and semicolons as delimiting characters, the picture below shows the array in cell range B3:F12. It is now obvious that the IF function has filtered records containing ony the condition.

#### Step 2 - VLOOKUP value and return value from column to cell D16

VLOOKUP(D14,IF(C3:C12=D15,B3:F12,""),3,FALSE)

becomes

VLOOKUP(D14, {"", "", "", "", ""; "", "", "", "", ""; "", "", "", "", ""; "", "", "", "", ""; "A", "South America", "The New Firm", "Tory", "Byrnes"; "", "", "", "", ""; "", "", "", "", ""; "", "", "", "", ""; "", "", "", "", ""; "F", "South America", "Trans United Airways", "Ervin", "Hennessey"}, 3, FALSE)

and returns "The New Firm" in cell D16.

### How to use the VLOOKUP function with two conditions applied to two columns (OR logic)?

This example demonstrates a formula that returns a value from a record that matches at least one of the two conditions, that is why it is called OR logic.

It becomes quite quickly obvious that the VLOOKUP function is not built for more advanced criteria, I am not using the VLOOKUP function in this example, to keep the formula as small as possible.

Array formula in cell D17:

To enter an array formula press and hold CTRL + SHIFT simultaneously, then press Enter once. Release all keys.

The formula bar now shows the formula enclosed with curly brackets telling you that you entered the formula successfully. Don't enter the curly brackets yourself.

If you are looking for a non-array formula here is one:

This formula returns a value from the last matching record contrary to the first formula above that returns a value from the first matching record.

### Explaining formula in cell D17

#### Step 1 - First condition

The first condition is specified in cell D14, to compare that value with the values in cell range B3:B14 I use the equal sign. It is a logical operator that returns TRUE or FALSE after the evaluations is made.

We are performing multiple calcualtions in one cell and this is the reason we need to enter this as an array formula.

B3:B12=D14

becomes

{"A";"B";"C";"D";"A";"B";"C";"D";"E";"F"}="A"

and returns

{TRUE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE}

#### Step 2 - Second condition

C3:C12=D15

becomes

{"Australia";"North America";"Asia";"Europe";"South America";"Australia";"North America";"Asia";"Europe";"South America"}="South America"

and returns

{FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; TRUE}

#### Step 3 - Add arrays to apply OR logic

The plus sign adds the two arrays row-wise, TRUE + TRUE = 2, TRUE + FALSE = 1 and FALSE + FALSE = 0

((B3:B12=D14)+(C3:C12=D15))>0

becomes

({TRUE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE} + {FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; TRUE})>0

becomes

{1;0;0;0;2;0;0;0;0;1}>0

and returns

{TRUE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; TRUE}

#### Step 4 - Identify the position

The MATCH function, as it is set up in this example, returns the relative position of the first found matching value based on an exact match.

MATCH(TRUE,((B3:B12=D14)+(C3:C12=D15))>0,0)

becomes

MATCH(TRUE,{TRUE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; TRUE},0)

and returns 1.

#### Step 5 - Return corresponding value

The INDEX function returns a value based on a row and column number.

INDEX($D$3:$D$12, MATCH(TRUE, ((B3:B12=D14)+(C3:C12=D15))>0, 0))

becomes

INDEX($D$3:$D$12, 1)

and returns "Atlantic Corporation" in cell D17.

### How to use the VLOOKUP function with many conditions applied to one column (OR logic)?

This example demonstrates how to use multiple conditions and the formula returns a value from the first record that matches any of the conditions.

The following formula does not use the VLOOKUP function, it is possible to build such formula but it will be complicated and much larger than needed.

Array formula in cell D17:

To enter an array formula press and hold CTRL + SHIFT simultaneously, then press Enter once. Release all keys.

The formula bar now shows the formula enclosed with curly brackets telling you that you entered the formula successfully. Don't enter the curly brackets yourself.

### Explaining formula in cell D17

#### Step 1 - Check values that match

The COUNTIF function counts values that equal a condition, however, it can also count multiple conditions but we must enter this formula as an array formula in order to calculate multiple values in one cell.

COUNTIF(D14:D15, B3:B12)>0

becomes

COUNTIF({"C";"D"},{"A";"B";"C";"D";"A";"B";"C";"D";"E";"F"})

and returns

{0;0;1;1;0;0;1;1;0;0}.

This array has as many values as there are values in cell range B3:B12, the values also corresponds to B3:B12. 0 (zero) indicates that the value is not equal to "C" or "D" and 1 shows that the value is equal to "C" or "D".

#### Step 2 - Find the position of the record

The MATCH function, as it is set up in this example, returns the relative position of the first found matching value based on an exact match.

MATCH(1, COUNTIF(D14:D15, B3:B12), 0)

becomes

MATCH(1, {0;0;1;1;0;0;1;1;0;0}, 0)

and returns 3. The first value that is equal to 1 is in 3rd position in the array.

#### Step 3 - Return corresponding value

The INDEX function returns a value based on a row and column number, the cell range is in a column only, we don't need to specify the column number.

INDEX($D$3:$D$12, MATCH(1, COUNTIF(D14:D15, B3:B12), 0))

becomes

INDEX($D$3:$D$12, 3)

and returns "Omni Consumer Products".

### How to use VLOOKUP function with multiple lookup values?

This example demonstrates how to use multiple lookup values in the VLOOKUP function, the lookup values are in cell D14 and D15.

The lookup values are found in row 5,6,9 and 10 but only the corresponding values from row 5 and 6 are returned, that is how the VLOOKUP function is supposed to work. If you need to extract multiple values based on a condition read this: 5 easy ways to VLOOKUP and return multiple values

Array formula in cell D14:D15:

This is an array formula, it returns multiple values. We need to enter it in multiple cells at once, here is how to do it.

Select cell range D14:D15, press with left mouse button on in the formula bar to see the prompt. Copy and paste above array formula to formula bar.

The VLOOKUP function demonstrated above has two lookup values which is fine as long as you enter it in as many cells as there are lookup values.

The downside with this formula is that it only extracts one return value per lookup value, read this article: Vlookup with 2 or more lookup criteria and return multiple matches

### VLOOKUP across multiple columns?

Unfortunately, the VLOOKUP function can't look in other columns than the left-most column in a cell range. We need to use other functions to accomplish that.

The image above demonstrates an array formula in cell D17 that returns a value from column D (Company Name) if the corresponding value on the same row in column B or C matches the specified value in cell D17.

Array formula in cell D17:

### Explaining formula in cell D17

#### Step 1 - Compare values to the lookup value

The equal sign lets you check if a cell value is equal to another value, the difference with this setup is that it compares a cell value to a cell range.

In this case B3:C12, this is fine as long as you enter the formula as an array formula. The formula performs multiple calcualtions in one cell, the result is an array containing boolean values, TRUE or FALSE.

B3:C12=D14

becomes

{"A","G"; "C","F"; "T","D"; "V","M"; "A","X"; "B","A"; "E","C"; "D","M"; "E","B"; "F","T"}="C"

Values are separated by a comma or semicolon, a comma is a column delimiting character and a semicolon is a row delimiting character.

{"A","G"; "C","F"; "T","D"; "V","M"; "A","X"; "B","A"; "E","C"; "D","M"; "E","B"; "F","T"}="C"

returns

{FALSE,FALSE; TRUE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,TRUE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE}

#### Step 2 - Replace boolean values with corresponding row number

The IF function allows you to change the array based on if the logical expression returns TRUE or FALSE.

IF(B3:C12=D14,MATCH(ROW(B3:B12),ROW(B3:B12)),"")

becomes

IF({FALSE,FALSE; TRUE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,TRUE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE}, MATCH(ROW(B3:B12), ROW(B3:B12)),"")

becomes

IF({FALSE,FALSE; TRUE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE; FALSE,TRUE; FALSE,FALSE; FALSE,FALSE; FALSE,FALSE}, {1;2;3;4;5;6;7;8;9;10}), "")

and returns

{"",""; 2,""; "",""; "",""; "",""; "",""; "",7; "",""; "",""; "",""}

#### Step 3 - Extract the smallest row number

The MIN function returns the samllest number from an cell range or array.

MIN(IF(B3:C12=D14,MATCH(ROW(B3:B12),ROW(B3:B12)),"")

becomes

MIN({"",""; 2,""; "",""; "",""; "",""; "",""; "",7; "",""; "",""; "",""})

and returns 2.

#### Step 4 - Return value

The INDEX function returns a value from a cell range or array based on a row and column number. Our example has only a single column so the column number is not needed.

INDEX($D$3:$D$12,MIN(IF(B3:C12=D14,MATCH(ROW(B3:B12),ROW(B3:B12)),"")))

becomes

INDEX($D$3:$D$12, 2)

and returns "Uplink Corporation".

### Can you concatenate VLOOKUP results?

No, you can't concatenate multiple return values from a VLOOKUP function. It will only return one instance. This example shows how to concatenate multiple values using multiple conditions using the TEXTJOIN, IF and COUNTIF functions.

Array formula in cell D17:

### Explaining formula in cell D17

#### Step 1 - Determine which records match the conditions

The COUNTIF function counts values equal a condition or in this case multiple conditions.

COUNTIF(D14:D15,B3:B12)

becomes

COUNTIF({"C"; "D"} ,{"A"; "B"; "C"; "D"; "A"; "B"; "E"; "D"; "E"; "F"})

and returns {0; 0; 1; 1; 0; 0; 0; 1; 0; 0}.

#### Step 2 - Replace array with values

The IF function allows you to change the array based on if the logical expression returns TRUE or FALSE.

IF(COUNTIF(D14:D15,B3:B12),D3:D12,"")

becomes

IF({0; 0; 1; 1; 0; 0; 0; 1; 0; 0}, D3:D12, "")

becomes

IF({0; 0; 1; 1; 0; 0; 0; 1; 0; 0}, {"Atlantic Corporation"; "Uplink Corporation"; "Omni Consumer Products"; "Galaxy Corp"; "The New Firm"; "ZiffCorp"; "Minuteman Cafe"; "Demo Company"; "Western Gas & Electric"; "Trans United Airways"}, "")

and returns

{"";"";"Omni Consumer Products";"Galaxy Corp";"";"";"";"Demo Company";"";""}

#### Step 3 - Concatenate values

The TEXTJOIN function allows you to concatenate a cell range or array, you can choose the delimiting character and if you want to ignore blank values.

TEXTJOIN(", ",TRUE, IF(COUNTIF(D14:D15,B3:B12),D3:D12,""))

becomes

TEXTJOIN(", ",TRUE, {"";"";"Omni Consumer Products";"Galaxy Corp";"";"";"";"Demo Company";"";""})

and returns "Omni Consumer Products, Galaxy Corp".

### How to use VLOOKUP with dates?

This example shows how to VLOOKUP using a condition, start and end date. The formula returns a value from the first record that matches all three conditions.

Array formula in cell C5:

### Explaining formula in cell C5

#### Step 1 - Identify rows with dates larger than the start date

This logical expression checks whether the dates in column Date are bigger (later) than the start date in cell C3.

Table3[Date]>=C3

becomes

{40909; 40910; 40911; 40912; 40913; 40914; 40915; 40916; 40917; 40918}>=40910

and returns

{FALSE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE}

#### Step 2 - Identify rows with dates smaller than the end date

The following logical expression checks whether the dates in column Date are smaller (earlier) than the end date in cell C3.

Table3[Date]<=C4

becomes

{40909;40910;40911;40912;40913;40914;40915;40916;40917;40918}<=40915

and returns

{TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;FALSE;FALSE;FALSE}

#### Step 3 - Multiply arrays

We want to know if both conditions are met, to do that we must multiply the arrays. TRUE * TRUE = TRUE (1), TRUE * FALSE = FALSE (0), FALSE * FALSE = FALSE (0)

(Table3[Date]>=C3)*(Table3[Date]<=C4)

becomes

{FALSE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE} * {TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE}

returns

{0;1;1;1;1;1;1;0;0;0}

#### Step 4 - Filter records that match

The IF function filters records that match both conditions.

IF((Table3[Date]>=C3)*(Table3[Date]<=C4),Table3,"")

becomes

IF({0; 1; 1; 1; 1; 1; 1; 0; 0; 0},Table3,"")

and returns

{"","","","",""; "B",40910,"Uplink Corporation","Amshula","Canty"; "C",40911,"Omni Consumer Products","Jaycee","Martin"; "D",40912,"Galaxy Corp","Tracy","Tuck"; "A",40913,"The New Firm","Tory","Byrnes"; "B",40914,"ZiffCorp","Santos","Cowart"; "C",40915,"Minuteman Cafe","Gen","Lindgren"; "","","","",""; "","","","",""; "","","","",""}.

#### Step 5 - VLOOKUP using the array

The VLOOKUP function uses the array returned from the IF function and looks for the lookup value in the left-most column in the array.

VLOOKUP(C2,IF((Table3[Date]>=C3)*(Table3[Date]<=C4),Table3,""),3,FALSE)

becomes

VLOOKUP(C2,IF({0;1;1;1;1;1;1;0;0;0},Table3,""),3,FALSE)

becomes

VLOOKUP(C2,IF({0;1;1;1;1;1;1;0;0;0},{"A", 40909, "Atlantic Corporation", "Birdie", "Schneider";"B", 40910, "Uplink Corporation", "Amshula", "Canty";"C", 40911, "Omni Consumer Products", "Jaycee", "Martin";"D", 40912, "Galaxy Corp", "Tracy", "Tuck";"A", 40913, "The New Firm", "Tory", "Byrnes";"B", 40914, "ZiffCorp", "Santos", "Cowart";"C", 40915, "Minuteman Cafe", "Gen", "Lindgren";"D", 40916, "Demo Company", "Edwin", "Shinn";"E", 40917, "Western Gas & Electric", "Allayna", "Egan";"F", 40918, "Trans United Airways", "Ervin", "Hennessey"},""),3,FALSE)

becomes

=VLOOKUP("A",{"","","","","";"B",40910,"Uplink Corporation","Amshula","Canty";"C",40911,"Omni Consumer Products","Jaycee","Martin";"D",40912,"Galaxy Corp","Tracy","Tuck";"A",40913,"The New Firm","Tory","Byrnes";"B",40914,"ZiffCorp","Santos","Cowart";"C",40915,"Minuteman Cafe","Gen","Lindgren";"","","","","";"","","","","";"","","","",""},3,FALSE)

and returns "The New Firm"

### What if I don't have the lookup column in the left-most column?

The VLOOKUP function can only look for values in the first column of the table_array. The formula below demonstrates how to do a lookup in any table column and return a value from any table column.

The INDEX and MATCH function is more versatile than VLOOKUP and it is easier to apply more conditions if needed, however, it still can only return one value even if there are more records that match. The INDEX, SMALL and IF function can return multiple values, read this article: 5 easy ways to VLOOKUP and return multiple values

Formula in cell C3:

Learn more about the INDEX and MATCH functions:

Gets a value in a specific cell range based on a row and column number.

Identify the position of a value in an array.

becomes

=INDEX(Table4[Item],4)

becomes

=INDEX({"A"; "B"; "C"; "D"; "A"; "B"; "C"; "D"; "E"; "F"},4)

and returns D in cell C3.

### VLOOKUP - Select column using a drop-down list

The worksheet shown above lets you select the column using a drop-down list from which you want the return value, this way you don't need to edit the formula when you need data from another column.

Array formula in cell C4:

#### How to create the drop down list in cell B4

- Select cell B4
- Go to "Data" tab
- Press with left mouse button on "Data Validation" button
- Select "List" i the drop down list
- Select source: =$C$8:$E$8

- Press with left mouse button on OK

### Explaining formula in cell C4

#### Step 1 -

VLOOKUP(C2, IF(Table2[Region]=C3, Table2, ""), MATCH(B4, Table2[#Headers], 0), FALSE)

becomes

=VLOOKUP(C2, IF(Table2[Region]=C3, Table2, ""), MATCH(Company Name", {"Item","Region","Company Name","First Name","Last Name"}, 0), FALSE)

becomes

=VLOOKUP(C2, IF(Table2[Region]=C3, Table2, ""), 3, FALSE)

and returns "The New Firm".

### Why do I want to convert the data set to an Excel Table?

If you convert your cell range to a table you can add or remove as many records to the Excel table as you want and the cell reference in the formula is automatically adjusted.

Use the table name and table column name in the VLOOKUP function to achieve this, see the formula bar in the picture above.

#### How to convert a cell range to an Excel defined Table?

- Select any cell in your data set.
- Go to tab "Insert" on the ribbon.
- Press with left mouse button on "Table" button to open a dialog box.

- Enable "My table has headers".
- Press with left mouse button on OK.

Learn more about excel tables:

An Excel table allows you to easily sort, filter and sum values in a data set where values are related.

How to return a value if lookup value is in a range

In this article, I will demonstrate four different formulas that allow you to lookup a value that is to be found […]

VLOOKUP of three columns to pull a single record

Question: Does anyone know how to do a VLOOKUP of three columns to pull a single record? Answer: Array formula in […]

Return multiple values if in range

The image above shows a formula in cell C11 that extracts values from column D if the number in cell […]

Have you ever tried to build a formula to calculate discounts based on price? The VLOOKUP function is much easier […]

How to use the VLOOKUP function

The VLOOKUP function lets you search the leftmost column for a value and return another value on the same row […]

Choose between two data sets to VLOOKUP

Question: How do I search a specific data set, I have two tables to choose from? Answer: Formula in cell C13: […]

### 33 Responses to “How to use VLOOKUP with multiple conditions”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

Wow I have never thought of using the Table like that...... really potent stuff!

chrisham,

Thank you for commenting! You can use arrays in most excel functions.

I am having a problem getting vlookup to work when asking it to check two different tables based on what data is percent in specific cells. Basically I want it to check one table if a persons gender is male, and another table if the gender is female. Any idea how I can accomplish this? I would really appreciate any help I could get. Thank you very much.

Hi Oscar,

I want to sum up results of Vlookup

please help

For eg,

Product No in Column A and qty sold in Column B

I Will need to derive qty sold of each product. It's a huge data of 2000 odd product list

please suggest

Vicky,

Here is a post about pivot tables:

https://www.get-digital-help.com/2012/11/09/analyze-trends-using-pivot-tables/

You can also use formulas. How to extract a unique distinct list:

https://www.get-digital-help.com/2009/03/30/how-to-extract-a-unique-list-and-the-duplicates-in-excel-from-one-column/

How to use the sumif function:

https://www.get-digital-help.com/2009/11/16/sum-values-between-two-dates-with-criteria-in-excel/

Remove the date criteria.

Hi OScar

SUMIFS,has worked great for me, Thanks for your help. Its been completely Superb

Hi Oscar,

Just a general question, which one is better for huge lookups

Vlookup or Index + Match

can we use index + match instead of vlookup, even if we need to extract values from the right side columns

Thanks

Krishna

Krishna,

Yes, read this: https://exceluser.com/blog/1107/why-index-match-is-far-better-than-vlookup-or-hlookup-in-excel.html

Hi Oscar.. I'm struggling using a lookup formula for extracting values from a large table.. it's something like:

Fruit Market

Apple Walmart

Pear Sigo

Grapes Sigo

Cherry Walmart

Orange 7-eleven

The idea is just extract the fruits from Walmart in a new table but excluding the rest of the fruits.. What do you suggest??? Thanking you in advance for your help...

Jose,

Array formula in cell D2:

=INDEX($A$2:$B$6, SMALL(IF($B$2:$B$6=$D$1, MATCH(ROW($B$2:$B$6), ROW($B$2:$B$6)), ""), ROW(A1)),COLUMN(A1))

Read more:

How to return multiple values using vlookup

Dear Oscar,

I want to vlookup with 2 conditions.

I want to search for value by using two criteria. ex: vlookup with invoice number and serial number search for the discription in other sheet or other related information. Each invoice number has multiple serial numbers or items.Ex. invoice number 1 has 1to 5 items, I need search for all 5 items from database to the main sheet.

Please help

Simao Pereira,

Can you provide some data and the desired outcome?

Awesome formula:

=VLOOKUP(C2,IF(B8:B17=C3,A8:E17,""),3,FALSE)

Thanks for sharing this technique.

=VLOOKUP(C2,IF(B8:B17=C3,A8:E17,""),3,FALSE)

Did anyone check this formula ? I get "Value" error (a value used in this formula is of the wrong data type). Any ideas ? ...

Andrei,

It is an array formula.

Select a cell

Type the array formula

Press and hold Ctrl + Shift simultaneously

Press Enter

Release all keys

If you did it right you now have curly brackets before and after the formula, in the formula bar.

It works. I've never done this before. I just feel so silly sometimes - whenever I think I know Excel, something new appears that makes me look like a hairstylist. :(

Hi,

Perhaps you can help me with a similar formula.

I am trying to keep track of components for manufacturing purposes. I have one table where i keep my manufacturing data (product, quantity and date) each of my products require a unique valve and i want to have another table where i can look up the item and if it falls in a particular month indicate the total quantity.

My goal here is to be able to accurately forecast my valve needs.

I have attached an example. https://postimg.org/image/3uvet6l2f/

The incoming valve column i use for valve orders that i place. the cylinder production column is where i need the formula to match the item and time period and return the results.

Thank you very much!

Hi Oscar,

Please how do I handle this case...

An excel column has up to a thousand entries and each entry is to be looked up in another column. The aim is to find out if their is any entry among the up to one thousand entries which is in the other column or not. Since the number of entries to be looked up for is large, I want to avoid doing this one at a time.

Ray,

Use the match function to see if an entry exists in another column.

MATCH(A1,C1:C100000,0) If it returns a number it exists, an error it does not exist.

If we have a data like this in one excel sheet

y 10.94.44.185/

w 10.94.44.184/10.94.44.185/

y 10.94.44.181/10.94.44.182

w 10.94.44.184/10.94.44.185/10.94.44.186

I want Y & W = highest details in second column

Y=10.94.44.181/10.94.44.182

W=10.94.44.184/10.94.44.185/10.94.44.186

which formula can I apply, please let me know some one.

Hi I'm trying to do a vlookup from detail related to a person ID. However, the ID has two records. One record is "Completed" and another record is "Pending Update". How do I formulate it such that the vlookup will pick up the "Pending Update" line instead of the "Completed"

I have a vlookup table that retrieves an employee list.

What I need is when I select an employee from the lookup.

When I move to the next row I only want to be able to select an employee that has not been previously selected.

To add to the above I need the function to select multiple employees.

Hi,

I have a back dated product wise period wise amendments of rates and I want to vlookup the new rate against the product for a specific date in the past.

Oscar, I know this is an older thread, but I am trying to use a version of the VLOOKUP and two conditions (date range)formula, but my table is on another tab and instead of matching my Id's from tab1 to the Ids in table 1,(C2 in the actual formula), it's providing the actual value in my table matching the cell reference from tab 1. So it's giving me the ID in cell A129 instead of trying to find a match for that ID in the table.

I am not sure what I am doing wrong. Can you provide assistance?

Tasha

Can you upload a workbook, I have trouble understanding.

[…] Using multiple conditions in VLOOKUP […]

I HAVE BELOW CODE

id name amt

1 Bijankur-BB2 390

2 pkm 240

3 bajra 495

4 induce 535

ORDER is punch in like this 4 Unit Fodder Grass Bijankur-BB2 50 gm Rs. 345

how can i use vlookp & index function

Need Help: I have an file with Column B having entries and i need to match these with my entries in column A. However the column B may have multiple relevant values in column B. How do i do it? Also if i enter any values of column B it has to give me an output of the values i have in column A.

Sample:

S.No City Variable

1 a 123

2 b 111

3 b 124

4 a 145

5 c 167

6 d 192

7 e 122

8 a 111

9 a 109

10 e 110

Type City Here a

S.No City Variable

1 a 123

4 a 145

8 a 111

9 a 109

Hi Srikanth

I believe this article is what you are looking for:Extract multiple records based on a condition

Hi Oscar,

Thanks for the explanation and examples. It helped me in using the conditional within vlookup funtion.

Great help for new learners.

Good Day to you, I have a question.

I need a Vlookup or should it be sumif formulas for 2 sheets, base on two criteria on sheet2. First the date (A1)in sheet 2, then the Item code (B1)in sheet 2, to get the total amount at sheet1 for a certain item.

its kinda like your first graph here, first find the Item, then Region, to get the answer.

but my answer is quantity and need to add up.

hope to get some help from u.

Thanks you so much

Thank you for the examples. I needed a way to look up workers' compensation class code premium rates by state. I had a table of about 200 class codes, in each of 3 states. Being able to find a class code rate based on the state required this 2 column lookup. The IF inside of the VLOOKUP did the trick perfectly!