This week I had a question from Diedre asking if she can use VLOOKUP to check multiple sheets…. 17 different sheets in fact.

The idea being that if VLOOKUP doesn’t find a match on the first sheet, it will check the next sheet and so on.

The good news is we can, the bad news is it’s a bit complicated….but if you’ve only got a few sheets I‘ll show you an easier formula at the end.

Below is our table that we want to populate by looking up the Product Code in column A and return the Product Description and Price.

Excel VLOOKUP Multiple Sheets

The challenge is that the product code information could be on Sheet2:

Excel VLOOKUP Multiple Sheets

Or Sheet3:

Excel VLOOKUP Multiple Sheets

Or Sheet4:

Excel VLOOKUP Multiple Sheets

The first thing we need to do is enter a list of our sheet names somewhere in the workbook and give them a named range. I’ll give mine the very imaginative name: SheetList

Excel VLOOKUP Multiple Sheets

Now we can enter our formula in cell B4:

=VLOOKUP(A4,INDIRECT("'"&INDEX(SheetList,MATCH(1,--(COUNTIF(INDIRECT("'"&SheetList&"'!$A$1:$c$4"),A4)>0),0))&"'!$A$1:$c$4"),2,FALSE)

It’s an array formula so we need to enter it with CTRL+SHIFT+ENTER.

We can then copy it down the column to lookup the remaining product codes.

Excel VLOOKUP Multiple Sheets

The above is just a small sample of the toys on my boy’s Christmas lists!

How this Formula Works

Unfortunately this formula doesn’t evaluate in order from left to right, so it’s a bit difficult to translate into English as I like to do, instead we’ll look at the separate components and understand what they’re doing.

First remember the syntax for the VLOOKUP Function is:

VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

In our formula we know everything except the table_array argument. Remember we don’t know what sheet contains our lookup_value.

Instead we use the INDIRECT, INDEX, MATCH and COUNTIF functions to build the table_array reference dynamically for each product code in column A like this:

=VLOOKUP(A4,INDIRECT("'"&INDEX(SheetList,MATCH(1,--(COUNTIF(INDIRECT("'"&SheetList&"'!$A$1:$c$4"),A4)>0),0))&"'!$A$1:$c$4"),2,FALSE)

1. The COUNTIF component

The COUNTIF part of the formula is checking each sheet in the SheetList to find a match. If it finds a match it counts 1, the other sheets return a zero.

=VLOOKUP("SKU001",INDIRECT("'"&INDEX(SheetList,MATCH(1,--(COUNTIF(INDIRECT ("'"&SheetList&"'!$A$1:$c$4"),"SKU001")>0),0))&"'!$A$1:$c$4"),2,FALSE)

Our formula now looks like this:

=VLOOKUP("SKU001",INDIRECT("'"&INDEX(SheetList,MATCH(1,{1;0;0},0))&"'!$A$1:$c$4"),2,FALSE)

The {1;0;0} above represents the count of matches on the 3 rows in the SheetList. You can imagine because it found a match for SKU001 on Sheet1 it looks a bit like this:

Excel VLOOKUP Multiple Sheets

2. MATCH Function

The syntax for the MATCH function is:

MATCH(lookup_value, lookup_array, [match_type])

From our formula: MATCH(1,{1;0;0},0)

Where zero [match_type] is an exact match.

The MATCH function is looking for the value 1 in the lookup_array {1;0;0} and returns its position. Which in this case is the first position, therefore our MATCH formula evaluates to 1 like this:

=VLOOKUP("SKU001",INDIRECT("'"&INDEX(SheetList,1)&"'!$A$1:$c$4"),2,FALSE)

Note: if it found a match on Sheet3 it would look like this:

MATCH(1,{0;1;0},0) and would evaluate to 2. i.e. the second value in the SheetList.

3. The INDEX function

INDEX Function syntax:

INDEX(reference, row_num, [column_num], [area_num])

Note: The last two arguments are optional (designated by the square brackets) and we don’t need them in this formula.

INDEX(SheetList,1)

The INDEX function uses the result from MATCH as the row number argument and returns a reference to the 1st value in the SheetList; Sheet2

Our formula now looks like this:

=VLOOKUP("SKU001",INDIRECT("'"&"Sheet2"&"'!$A$1:$c$4"),2,FALSE)

4. The INDIRECT Function

The INDIRECT Function returns a reference specified by a text string.

Everything inside the INDIRECT formula above is text, you can tell by the double quotes surrounding it. The INDIRECT function takes that text and converts it to a reference.

COUNTIF, INDEX and MATCH have done the heavy lifting, now all INDIRECT needs to do is add the necessary apostrophes to the reference and give it to VLOOKUP.

It’s a bit difficult to see the apostrophes from the double quotes so I’ve made them red below:

=VLOOKUP("SKU001",INDIRECT("'"&"Sheet2"&"'!$A$1:$c$4"),2,FALSE)

Which becomes:

=VLOOKUP("SKU001",'Sheet2'!$A$1:$c$4,2,FALSE)

VLOOKUP Multi-cell Array Formula

Now we’ve found the product descriptions we could copy the formula into column C and change the col_index_num argument, or as Finn, my 4 year old, says ‘we could be a bit more cleverer’ and change the formula slightly so that it can find both results with the one formula!

To do this we’ll use a multi-cell array formula.

When you enter a multi-cell array formula you first select all the cells you want populated, then you enter the formula.

Since we’ve already got our formula in cell B4 we can select B4 and C4, then press F2 to edit the formula.

All we need to change is the col_index_number argument like this:

=VLOOKUP(A4,INDIRECT("'"&INDEX(SheetList,MATCH(1,--(COUNTIF(INDIRECT ("'"&SheetList&"'!$A$1:$c$4"),A4)>0),0))&"'!$A$1:$c$4"),{2,3},FALSE)

Then press CTRL+SHIFT+ENTER and you now have your price information and you have used the same formula in both B4 and C4.

Excel VLOOKUP Multiple Sheets

Now you can copy cells B4 and C4 down columns B and C and you’re done :)

The Easier Option

OK, if your head is hurting here’s an easier solution that will do if you’ve only got 2 or 3 sheets to lookup.

Warning: Any more than 3 sheets and you’re susceptible to a repetitive strain injury so it’s best to use the first solution.

VLOOKUP Multiple Sheets with IFERROR

All we do is wrap the VLOOKUP formulas in an IFERROR function.

Excel VLOOKUP Multiple Sheets

=IFERROR(VLOOKUP($A4,Sheet2!$A$2:$C$4,2,FALSE),IFERROR(VLOOKUP($A4,Sheet3!$A$2:$C$4,2,FALSE),VLOOKUP($A4,Sheet4!$A$2:$C$4,2,FALSE)))

In English it reads:

Lookup the product code in A4 on Sheet2 and return the value in column 2 of the range A2:C4, if you can’t find an exact match in Sheet2 check Sheet3, if you can’t find an exact match in Sheet3 check Sheet4.

VLOOKUP Dynamic col_index_num

The formula above is good, but we want to copy it to column C for the price and in doing so we’d need to change the col_index_num argument.

An easier way to do this is to make it dynamic by using the COLUMNS function for the col_index_num argument like this:

=IFERROR(VLOOKUP($A4,Sheet2!$A$2:$C$4,COLUMNS($A$3:B$3),FALSE),IFERROR(VLOOKUP($A4,Sheet3!$A$2:$C$4,COLUMNS($A$3:B$3),FALSE),VLOOKUP($A4,Sheet4!$A$2:$C$4,COLUMNS($A$3:B$3),FALSE)))

The COLUMNS function returns the number of columns in an array or reference.

A3:B3 = 2 columns in the range.

Therefore COLUMNS($A$3:B$3) evaluates to 2 which is the col_index_num we want.

Note how the first cell in the range $A$3 is absolute but the second cell in the range is only absolute for the row number.

Now when I copy the formula across to column C my formula dynamically updates like so:

=IFERROR(VLOOKUP($A4,Sheet2!$A$2:$C$4,COLUMNS($A$3:C$3),FALSE),IFERROR(VLOOKUP($A4,Sheet3!$A$2:$C$4,COLUMNS($A$3:C$3),FALSE),VLOOKUP($A4,Sheet4!$A$2:$C$4,COLUMNS($A$3:C$3),FALSE)))

And COLUMNS($A$3:C$3) evaluates to 3.

Download the workbook.

If you liked this click the buttons below to share it with your friends and colleagues on Facebook, Twitter, Google+ or LinkedIn….or leave me a comment :)

Share This

Please share this or leave a comment and I'll make sure you get a personal reply.

Leave a Comment

Current day month ye@r *

{ 96 comments… read them below or add one }

Steven Kfare June 19, 2014 at 12:26 am

Hi,

Is there a cut-off point with the number of sheets that method one becomes not optimal to use (i.e. 10 sheets with 100k rows each)? At that point would it be better to use a macro or some other method?

Reply

Mynda Treacy June 19, 2014 at 9:57 am

Hi Steven,

I haven’t tested the formula on large volumes of data so it’s hard to say. One thing I would consider is consolidating your data into one sheet, as it should be.

This formula is necessary because the data isn’t stored in a single tabular format. It’s spread over multiple sheets which is a no-no.

Kind regards,

Mynda

Reply

Steven Kfare June 19, 2014 at 11:13 pm

Unfortunately,the data that I am trying to match up against is larger than the Excel row limit therefore I needed to break out to multiple sheets.

Reply

Mynda Treacy June 20, 2014 at 8:17 am

Ah, sounds like time for a database then. How about putting your data in Access and using PivotTables to summarise it?

Mynda

Reply

Robert Haynes May 25, 2014 at 1:16 pm

Hello, I see this is an old article, but I was hoping you could help me…

I have a formula that searches 1 worksheet in the document and displays all rows that which meet a certain criteria for 1 of 3 columns.

=IFERROR(INDEX(HHBN!B$2:B$622,SMALL(IF(HHBN!$E$2:$E$622=$C$1,ROW(HHBN!B$2:B$622)-ROW(HHBN!B$2)+1,IF(HHBN!$M$2:$M$622=$C$1,ROW(HHBN!B$2:B$622)-ROW(HHBN!B$2)+1,IF(HHBN!$AC$2:$AC$622=$C$1,ROW(HHBN!B$2:B$622)-ROW(HHBN!B$2)+1))),ROWS(HHBN!B$2:HHBN!B2))),”")

I’m trying to incorporate your idea here of searching through all four tabs, but I can’t get it to work. Thank you for any help you can give.

Reply

Catalin Bombea May 25, 2014 at 6:07 pm

Hi Robert,
Please upload a sample workbook with your data structure and details on what are you trying to achieve. It’s almost impossible to see why your formula is not working. You can use our Help Desk.

Catalin

Reply

Robert Haynes May 26, 2014 at 10:59 am

Catalin,

Thank you for the response. The formula I posted works how it is suppose to. I was hoping to use the idea in this post to adjust it so it will search all tabs instead of just one, but I can’t figure it out. I’ll try to upload it to the help desk. Thank you again for your response.

Robert

Reply

Catalin Bombea May 26, 2014 at 10:49 pm

Ok Robert, i’ll wait for that file and details, we’ll find a solution for you.
Cheers,
Catalin

Reply

Randy Vargas May 12, 2014 at 5:46 pm

since i was high school and colleges, I only now we learn this vlookup but it’s difficult when you getting started until the next steps so we need more time to learn and study this vlookup.

Reply

Mynda Treacy May 13, 2014 at 8:29 am

Hi Randy,

It’s all about practice. The more you do it the easier it will get.

Cheers,

Mynda.

Reply

Joe Stephens May 10, 2014 at 7:54 am

Hi Mynda -
This is similar to a challenge I am experiencing – with a little twist.
I am trying to lookup data in a Workbook based on the value of two cells in a Worksheet.
Here is the example:
Worksheet ‘A’, cell C8 contains the letter “P”.
Workbook ‘B’ contains 26 worksheets – A thru Z.
1. Go to the worksheet in Workbook ‘B’ based on the letter in cell C8.
2. Lookup the value of cell D8 in the same worksheet.
3. Array:Workbook ‘B’, Worksheets A-Z,$C:$H,6,0
I would appreciate any assistance you can offer.

Thanx!

Reply

Catalin Bombea May 10, 2014 at 1:53 pm

Hi Joe,
Please upload a sample workbook on Help Desk
This way we can work on a real data structure, and the result is not just an idea.
Thank you for understanding.
Catalin

Reply

jinal January 16, 2014 at 2:44 am

sheet1 in total then sheet 2 in total then i give a sheet1+sheet2 total in sheet3 plz ans me with example plz

Reply

Catalin Bombea January 16, 2014 at 3:17 am

Hi Jinal,
For example, if the total value for sheet1 is in cell E14, and same for sheet2, you can use a 3D SUM to add the totals from sheets 1 and 2:
=SUM(Sheet1:Sheet2!E14)
If it’s not what you wanted, please use our Help Desk to upload a sample workbook with detailed description of what you are trying to achieve.
Catalin

Reply

Robert Singh January 13, 2014 at 10:25 pm

Superb! Wow!

Reply

Mynda Treacy January 14, 2014 at 11:37 am

Thanks, Robert :-)

Reply

Ajeshkumar January 12, 2014 at 11:33 pm

Very useful step by step explanation, even the beginners can do well

Reply

Mynda Treacy January 13, 2014 at 9:02 am

Thanks, Ajeshkumar :-) Glad you liked it.

Mynda.

Reply

Hasan December 5, 2013 at 9:03 pm

Hi Mynda,
This is very usefull. But along the same lines I would like to use similar formula to access the data from different excel reports (stored in various folders) instead of sheets in a same workbook.
For examples, my files are saved here:
c:\2013\Nov13\a.xls
c:\2013\Nov13\b.xls
c:\2013\Nov13\c.xls
c:\2013\Nov13\d.xls

Formula:
=VLOOKUP(BI20,INDIRECT(“‘”&INDEX(SheetList3,MATCH(1,–(COUNTIF(INDIRECT(“‘”&SheetList3&”‘!$A$1:$c$9″),BI20)>0),0))&”‘!$A$1:$c$9″),2,FALSE)

SheetList3:
c:\2013\Nov13\a.xls
c:\2013\Nov13\b.xls
c:\2013\Nov13\c.xls
c:\2013\Nov13\d.xls

I tried using the above entries in a SheetList but the formula didn’t work. How should I do this ? Do I need to put the file name in double/single quotes, etc. ? I’ve tried everything but it didn’t work.

Thanks
Hasan

Reply

Catalin Bombea December 5, 2013 at 10:30 pm

Hi Hassan,
Please provide a sample of your workbooks, so i can test on your environement, this way you will have a faster solution.
You can use the Help Desk: http://www.myonlinetraininghub.com/helpdesk/
Cheers, Catalin

Reply

Rajanz August 27, 2013 at 5:40 am

Hi, i have a workbook with 6 sheets, each sheet has 15 colums & approx 6000 rows of data, so i want to run a vlookup for a specific criteria but the consition is that the formula should check all the 6 sheets before giving the result, is that possible??

Reply

Mynda Treacy August 27, 2013 at 9:22 am

Hi Rajanz,

Yes, it’s possible using the formula in the blog post above. Note: it will only work if the match is only one one sheet in your workbook. If you have multiple matches it won’t return the correct result.

Kind regards,

Mynda.

Reply

Rajanz September 3, 2013 at 6:24 am

Hi Mynda,

I tried applying the formula to my worksheet but it doesnt return any value, i unable to debug the error, would it possible to look at the sheet & suggest a solution?

Reply

Mynda Treacy September 3, 2013 at 2:30 pm

Hi Rajanz,

You can send me the workbook via the help desk and I’ll take a look. Please include specific instructions on what you’re trying to do and give me an example of your expected result.

Thanks,

Mynda.

Reply

Chase August 21, 2013 at 6:10 am

I am using this formula to look over many pages and for some reason it works on some of the cells but others it either returns a value of “#N/a” or “0″. What is the difference between the two?

Reply

Mynda Treacy August 21, 2013 at 1:42 pm

Hi Chase,

A #N/A error means the lookup_value cannot be found. A zero means it found the lookup_value but the cell you asked it o returned was either empty or contained a zero.

I hope that helps.

Kind regards,

Mynda.

Reply

Kevin August 20, 2013 at 6:01 am

I read the previous post.. and success! sorry to bother. Thanks :)

Reply

Mynda Treacy August 20, 2013 at 7:33 am

Cheers, Kevin. Glad you figured it out.

Reply

Kevin August 20, 2013 at 5:47 am

Hey, I understand about 70% of this and am still re-reading it to fully understand. Is there a way however to use this formula.. but refer to a seperate workbook for the alternating sheets?

Reply

Brad Firsich August 20, 2013 at 3:04 am

Topic: Excel Lookup, Multiple Sheets

All we need to change is the col_index_number argument like this:
=VLOOKUP(A4,INDIRECT(“‘”&INDEX(SheetList,MATCH(1,–(COUNTIF(INDIRECT (“‘”&SheetList&”‘!$A$1:$c$4″),A4)>0),0))&”‘!$A$1:$c$4″),{2,3},FALSE)

How does the above formula evaluate {2,3}?? I have always typed the column number I needed.

Thanks in advance.

P.S. Your website is fantastic!!

Reply

Mynda Treacy August 20, 2013 at 7:53 am

Hi Brad,

Thanks for your kind words. Glad you like our site :)

The formula you’re referring to is a multi-cell array formula. i.e. the formula is entered in multiple cells all at once.

Because we’re entering the same formula in both columns (Product description & price), we need to give it the col_index_number for both columns. This is the {2,3} information in the formula (known as an array constant). The array formula knows to use 2 for the Product Description column and 3 for the Price column.

I hope that helps.

Kind regards,

Mynda.

Reply

Steve August 8, 2013 at 3:04 am

Mynda,

Thanks for this formula! I was able to get it to work when everything is in the same workbook, but the application I’m using it for has so many sheets that I want to separate them into two workbooks. I can’t get the reference to work. Basically, this is what I have:

=VLOOKUP($B3,INDIRECT(“‘”&INDEX(‘[workbook2.xlsx]Sheet1′!SheetList,(MATCH(1,–(COUNTIF(INDIRECT(“‘”&’[workbook2.xlsx]SheetList’!SheetList&”‘!$c$8:$d$8″),$B3)>0),0)))&”‘!$c$8:d$8″),2,FALSE)

Any suggestions?

Reply

Mynda Treacy August 8, 2013 at 10:12 pm

Hi Steve,

Does your SheetList contain the workbook name as well as the sheet name?

INDIRECT is deriving the range to be looked up but since it’s in another workbook it also needs the worksheet name, not just the sheet name.

Kind regards,

Mynda.

Reply

Steve August 9, 2013 at 12:44 am

Thanks for the reply. I thought of that, so I tried with an unnamed list as well, and just dragged a copy of the sheet over to a new workbook so it would update the address automatically. So the list started out as:

Students!$B$3:$B$34

…and became:

‘[Equipment Checkout.xlsx]Students’!$B$3:$B$34

Here, “Students” is the worksheet with the list of sheet names on it (from B3:B34), each sheet is named after a student, and “Equipment Checkout” is the workbook that contains the sheets. When I drag one of the equipment inventories (Sleeping Bags, for example) over to a new book, it changes the list address as above, but I still get #n/a. Just can’t figure this one out.

Thanks for your help.

Reply

Steve August 9, 2013 at 1:18 am

I thought about your response and tried something new, still to no avail. I put the workbook name “Equipment” in cell B2 and changed the list to B2:B34. I still get the #n/a error.

Is that what you meant?

Reply

Mynda Treacy August 10, 2013 at 7:49 pm

Hi Steve,

I got this formula to work:

=VLOOKUP(A7,INDIRECT(“‘”&INDEX(Book3!sheetlist,MATCH(1,–(COUNTIF(INDIRECT(“‘”&Book3!sheetlist&”‘!$A$1:$c$4″),A7)>0),0))&”‘!$A$1:$c$4″),3,FALSE)

Where my ‘sheetlist’ is in Book3.xlsx. How does that compare to what you’ve tried?

Mynda.

Steve August 12, 2013 at 11:53 am

I tried that and still had trouble, but I did find a solution after thinking about your last post! Like you did, I put the workbook in the formula, and all I had to do was put the workbook location in front of every item on the sheetlist. So instead of just sheet1, sheet2, etc. the list looks like Drive:Folder:[workbook.xlsx]sheet1.

Now it works perfectly. Thanks for your help!

Steven D'hoe August 2, 2013 at 10:06 pm

Hi Mynda,
Slight variation… how do I check where a value is present in multiple sheets?
Your IFERROR/VLOOKUP solution stops at soon as it find a hit. I want to keep going and make sure I find another hit.
I’ve tried COUNTIFS, VLOOKUPS, SUMPRODUCT and MATCH… but they don’t work as the value I’m looking for is not always in the same position in both tables, ie. the code could be the 2nd row in the first sheet/array and in the 18th row in the second sheet/array.
Please help… can’t find the answer.
Thanks,
Steven.

Reply

Mynda Treacy August 2, 2013 at 10:23 pm

Hi Steven,

Do you want to sum these multiple instances of a match? If so the 3D SUMIFS might be what you’re after.

If that’s not it please send me a sample file via the help desk so I can see what you’re working with.

Cheers,

Mynda.

Reply

ChrisS July 24, 2013 at 4:25 am

Mynda,

This is super helpful but how would I edit this if the sheets I’m trying to access are in another workbook? I understand indirect doesn’t work unless the other workbook is open (unless I download the add-on that lets you do so). Any help would be greatly appreciated!

Reply

ChrisS July 24, 2013 at 4:26 am

Woops never mind, just read the comment above!

Reply

Mynda Treacy July 24, 2013 at 9:26 am

:) Cheers, Chris.

Reply

Jim July 19, 2013 at 11:54 pm

Hi this is great and really helpful but currently i have a vlookup to search another workbook which has ever increasing amounts of rows.
The number of rows have reach their maximum so now it is recording data on a second sheet.
My question is can you use this to look up multiple sheets on another workbook?
thanks in advance
jim

Reply

Mynda Treacy July 20, 2013 at 3:41 pm

Hi Jim,

If you’re running out of rows it sounds like it’s time to put all that data into Access.

I imagine you can use that formula across multiple workbooks but you’d have to add the workbook name in front of the worksheet name so that the INDIRECT function had the correct cell address.

The reference would look a bit like this:

'[worbook a.xlsx]sheet1'!C1

Where the workbook name is inside [square brackets].

Also, the formula will only work when both workbooks are open. INDIRECT doesn’t work if referencing a closed workbook.

I hope that helps. Let me know if you get stuck and I’ll take a look.

Kind regards,

Mynda.

Reply

Shyam June 27, 2013 at 1:18 am

Really helpful, lucid, attractive and cool…

Reply

Mynda Treacy June 27, 2013 at 7:30 am

Thank you, Shyam :)

Reply

Mynda Treacy June 27, 2013 at 10:51 am

Thanks, Shyam :)

Reply

Rodolfo July 12, 2013 at 11:09 am

Thank you. It worked quite well; however, my spreadsheet has 50 worksheets & the formula works only for the the 1st ten, although the the named range I created contains all the 50 worksheets. Is there any way to make it check all the 50 worksheets?

Appreciate your help.

Reply

Mynda Treacy July 12, 2013 at 12:44 pm

Hi Rodolfo,

Not sure why it wouldn’t work for all 50 sheets. Are you able to send me the file via the help desk or is it too big?

Cheers,

Mynda.

Reply

MF June 23, 2013 at 12:53 am

That is brilliant.
Could you pls further explain what’s the purpose of –(,>0)?
As I find that the formula seems working properly without it; but interestingly if I change input the formula as array with Column Index {2,3}, it doesn’t work…
So what is the magic of the –??
Appreciate your explanation! :)

Reply

Mynda Treacy June 23, 2013 at 10:56 pm

Hi MF,

Well spotted. If you don’t use the >0 test you can also omit the double unary –, so the formula would become:

=VLOOKUP(A4,INDIRECT("'"&INDEX(SheetList,MATCH(1,(COUNTIF(INDIRECT("'"&SheetList&"'!$A$1:$c$4"),A4)),0))&"'!$A$1:$c$4"),2,FALSE)

The double unary converts TRUE/FALSE outcomes (resulting from the >0 test) to 1′s and 0′s so they can be used in the MATCH part of the formula. By leaving out the >0 the COUNTIF evaluates to numbers, so the double unary isn’t required.

I hope that helps.

Kind regards,

Mynda.

Reply

PARAM April 30, 2013 at 9:51 pm

THANKS A LOT

IT IS VERY GOOD EXAMPLE AND MUCH USEFUL DON’T KNOW ANY THING PEOPLE ALSO.

thanks
Param

Reply

Mynda Treacy May 1, 2013 at 10:02 am

Cheers, Param :)

Reply

SILAMBARASAN.S April 24, 2013 at 7:27 pm

Dear Sir/Madam,

I would like to learn “Vlookup” formula.. i have preparing many statment, it is take more time to do and completed, if i know how to use the vlookup formula into it, it will help us to time saving. The problem is No. 1. For Example: while the employees resigned the job next month when we will going to prepare the employees register i need the current employees name list excepted the resigned employees.
Please help me. Thank you!
Best Regards,
S.SIMBU.,
Chennai-Tamil Nadu-INDIA

Reply

Mynda Treacy April 25, 2013 at 8:20 pm

Hi Silambara San.s,

You’ll need to send your file to the help desk so we can see exactly how it is laid out. Please also provide clear instructions to help us understand your needs.

Kind regards,

Mynda.

Reply

Duane Clark April 21, 2013 at 5:31 am

This was GREAT!!!! Been trying to figure out how to write a nested formula for thisl

Reply

Mynda Treacy April 21, 2013 at 7:19 pm

Cheers, Duane :)

Reply

Kent Collins April 3, 2013 at 9:42 am

Very, very cool and perfect for a logistics solution that I am putting together.
However, I am not able to recreate the Excel array solution on a google spreadsheet. Do you have any idea why that would be? I get a a parse error.
Thank you

Reply

Carlo Estopia April 4, 2013 at 11:36 am

Hi Kent,

As much as we would want to shed some light on your problem,
We don’t have much expertise to our disposal regarding Google spreadsheets.

All I know is that not all of Excel’s functions will work with Google;hence,
It really depends on what funtions you’re using.

Cheers,

CarloE

Reply

John Keyes July 2, 2014 at 4:21 pm

Now that Google has significantly changed their Sheets app, can you shed light now on how this can be done? I tried to do this in Google Sheets and the only stumbling block (after hitting ctrl-shift-enter) was that the MATCH parameter was not recognized: “Did not find value ’1′ in MATCH evaluation.”

Thanks!
John

Reply

Mynda Treacy July 2, 2014 at 4:55 pm

Hi John,

Sorry, I’m not familiar with Google Sheets. Only Excel :-)

Kind regards,

Mynda

Reply

Christophe Vercarr July 17, 2014 at 8:13 pm

Hey John,

I’m having the same problem as yours. Been looking for a solution the last couple of the days with little success so far. Have ultimately found a solution to this problem?

Regards

Reply

John Keyes July 18, 2014 at 3:58 am

Nothing yet Christophe

But I am monitoring it because it’s solving a number of problems with clients that only work with Google Docs. This is perhaps in the wrong forum…

If I find out more, I will come back…

owais March 25, 2013 at 2:05 pm

nice sharng

Reply

Carlo Estopia March 25, 2013 at 8:45 pm

Hi Owais,

Nice words. Thank you, on behalf of Mynda.

Cheers.

CarloE

Reply

mohit February 28, 2013 at 8:07 pm

Hi Mynda,

Great code… works like a charm..
But I have one issue.. I am using VBA and the number is sheets which will have the data is not known in the beginning… so my query is
1. How do i create a named array at run time
2. how do i insert the formula in the cell using VBA
3. This formula gives rsults only if I insert it in the cell and press ctrl+shift+ enter in each cell individually… if i drag then i dnt get the results.

Awaiting your comments on the same

Reply

Carlo Estopia March 1, 2013 at 3:16 pm

Hi Mohit,

1. To create a named array:
Horizontal

    ActiveWorkbook.Names.Add Name:="RunTime", RefersToR1C1:= _
        "={""jay"",""wash""}" 
    

or Vertical

    ActiveWorkbook.Names.Add Name:="RunTime", RefersToR1C1:= _
        "={""jay"";""wash""}"
    

2. Code to put contants to array to a range (I presume you already know how to add a commandbutton because you said you’re using VBA). I’m saying this anyway: Add a commandbutton and copy&paste the code as applicable(Horizontal, Vertical)
how to add commandbutton
Horizontal

   Dim s As Variant
   s = Evaluate(ThisWorkbook.Names("RunTime").RefersTo)
   Range("A1:B1").value = s
   

or Vertical

   Dim s As Variant
   s = Evaluate(ThisWorkbook.Names("RunTime").RefersTo)
   Range("A1:A2").value = s
   

3. Regarding this… are you having problem with this one? lol.
I am not in the proper position to answer you this because I am
not one of the creators of Excel. To give you a hint however, named arrays
are not technically arrays but constants;hence, if you notice I used the Evaluate()
function to put it into an array. Think about the transpose function… you’ll get
the idea. And please, there’s nothing we can do about it.

Cheers.

Carlo

Reply

mohit March 1, 2013 at 11:29 pm

Dear Carlo,

Many thanks for your inputs.

I got my doubts clarified by googling a bit.
Regarding point 2, guess my question was not clear.
What I want to know is,
If I insert it manually in a cell I will type

=VLOOKUP(A4,INDIRECT(“‘”&INDEX(SheetList,MATCH(1,–(COUNTIF(INDIRECT(“‘”&SheetList&”‘!$A$1:$c$4″),A4)>0),0))&”‘!$A$1:$c$4″),2,FALSE)

and press ctrl+shift+enter

But if I want to insert this through VBA I will have to insert the command

Range(“A1″).FormulaArray = “eqivalent of the VLOOKUP formula” and then loop this statement till the end of the sheet.

now what I want to know is what will be the eqivalent of this VLOOKUP formula???

Reply

Carlo Estopia March 2, 2013 at 11:24 am

Hi Mohit,

LOLz.I could hardly see that was your intended question. I thought you were relating 2 from 1.

Anyways…. so much of semantics….

Try this:

Range("A1").FormulaArray = _
        "=VLOOKUP(R[-13]C[-3],INDIRECT(""'""&INDEX(SheetList,MATCH(1,–(COUNTIF(INDIRECT(""'""&SheetList&""'!$A$1:$C$4""),R[-13]C[-3])>0),0))&""'!$A$1:$c$4""),2,FALSE)"

Range("A1").AutoFill Destination:=Range("D17:D21"), Type:=xlFillDefault

Note: This is the equivalent of your formula in this post :=VLOOKUP(A4,INDIRECT(“‘”&INDEX(SheetList,MATCH(1,–(COUNTIF(INDIRECT(“‘”&SheetList&”‘!$A$1:$c$4″),A4)>0),0))&”‘!$A$1:$c$4″),2,FALSE)

Cheers.

CarloE

PS: I really didn’t get to troubleshoot the formula because I don’t have the data that will perform the INDIRECT & Match function to return
the table array… hence it is returning an Error.But if you’ll put this all in a commandbutton, this will show the formula that you presented to me
in this post. If this will function in yours, then good. If not, you might as well send your file through HELP DESK. so we can give you the exact formula you need!!!

Reply

Francie February 27, 2013 at 11:28 pm

I am trying to do vlookup and hlookup together. I need to get the exact figure for a column and row from another sheet, please help I am stuck. Thank you

Reply

Carlo Estopia February 28, 2013 at 11:37 am

Hi Francie,

Please try this formula:

                Kobe the black mamba's stats last 5 games
  B       C       D      E        F      G 
2		Points Per Quarter				
3		 1	2	3	4	
4Team Vs Utah	 15	5	10	0	
5	 Phoenix 16	6	11	1	
6	 Chicago 17	7	12	2	
7	 OKC     18	8	13	3	
8	 Miami	 19	9	14	4	
						
						
Team Vs:Chicago	(C11)				
Quarter: 3	(C12)				
						
Score(Formula):=VLOOKUP(C11,C4:G8,MATCH(C12,D3:G3)+1,FALSE) result:12									

The data is B2:G8 including the headers Points Per Quarter and Team Vs
The lookup values are in C11 and C12. You may just hardcode the lookupvalues like this

=VLOOKUP("Chicago",C4:G8,MATCH(3,D3:G3)+1,FALSE)

Read More VLOOKUP’s

Cheers.

CarloE

Reply

Debbie February 5, 2013 at 11:20 am

Awesome Mynda, thank you very much.

Reply

Mynda Treacy February 5, 2013 at 2:50 pm

You’re most welcome, Debbie :)

Reply

Adam February 3, 2013 at 5:13 pm

HI Mynda
As always, how to make the hard and complicated formula’s look easy, with a step by step break down, I’ve been using excel since 1996, and still I find new tricks and tips (inspired by you blog)
Thank you
Regards
Adam

Reply

Mynda Treacy February 3, 2013 at 5:20 pm

:) Wow, thanks Adam.

Reply

Lhey January 29, 2013 at 7:53 pm

Hi Mynda, I can’t seem to make the formula work.
Can I send you my excel file so you may kindly check where I went wrong?
Please….

Thanks :)

Reply

Mynda Treacy January 30, 2013 at 10:22 am

Hi Lhey,

Sure, please send your file via the help desk.

Kind regards,

Mynda.

Reply

Lhey January 30, 2013 at 1:07 pm

Hi Mynda,

It’s working now. Just made a mistake in the Name Range part.
Your formula is awesome!

Thanks,
Lhey

Reply

Mynda Treacy January 30, 2013 at 1:19 pm

Great :) Glad you got it working.

Reply

Mehul January 22, 2013 at 6:45 am

Hello Mynda, I have gone through the various tricks and techniques. The VLOOKUP for multiple sheets is an excellent piece and the way you have explained is terrific!!! I am advanced excel user but after going through your tricks, I really feel that you are Goddess of Excel in front of whom I am dwarf. Thanks dear for your tips on excel.

Reply

Mynda Treacy January 22, 2013 at 9:19 pm

You’re welcome. Thanks for your kind words, Mehul :)

Reply

Philip January 5, 2013 at 6:43 am

Question- How could this formula be revised to allow for this scenario.
For example what if “Spiderman” was on multiple tabs. Only one tab would have a cost associated. For example sheet2 value 0, sheet3 value $28.00.
The formula; as is would return 0, ie returns the first match, but what I want is to return the $28 from sheet3

Reply

Mynda Treacy January 5, 2013 at 7:45 pm

Hi Philip,

You can use the 3D SUMIF formula for this.

Kind regards,

Mynda.

Reply

Philip January 7, 2013 at 12:28 pm

Thank you for your succinct solution

Reply

Mynda Treacy January 7, 2013 at 12:38 pm

You’re welcome, Philip :)

Reply

Jerry Beaucaire December 20, 2012 at 12:07 am

If you’d like to take this one step further, on my site here where that same technique is demonstrated there is an additional application that uses that same technique to create a dynamic HYPERLINK in an adjacent cell that you can click to jump directly to the data on that specific sheet.

3D Vlookup & 3D Hyperlink – http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/search-functions/3d-lookup

Reply

Mynda Treacy December 20, 2012 at 6:49 am

Thanks for sharing, Jerry :)

Reply

tristan tran December 13, 2012 at 7:37 pm

just looking at this gives me a headache :(

Reply

Mynda Treacy December 13, 2012 at 8:30 pm

:) this is quite an advanced formula, Tristan. Maybe start off with a regular VLOOKUP first.

Reply

renjini November 23, 2012 at 6:46 pm

The data was very useful, but the formula looks too lengthy.

Reply

Mynda Treacy November 24, 2012 at 9:25 am

Hi Renjini,

Thanks for your feedback. Have you got an alternative? Perhaps you’d like to share it.

Cheers,

Mynda.

Reply

r November 21, 2012 at 11:31 pm

Countif is a function amazing … and here great use with indirect function … I had never seen it work so. Thanks Mynda, good trick!

Reply

Mynda Treacy November 22, 2012 at 10:50 pm

Thanks, r. Glad you liked it :)

Reply

Tahir Rasheed November 21, 2012 at 3:30 pm

Fantastic

Reply

Mynda Treacy November 21, 2012 at 7:46 pm

Cheers, Tahir :)

Reply

Mynda Treacy August 12, 2013 at 1:22 pm

Brilliant! Glad you got there in the end :)

Reply

Previous post:

Next post: