VLOOKUP formula in excel with examples

Share

Facebook
Twitter
LinkedIn

VLOOKUP stands for vertical lookup and we can use to scan a column and get matching data. In this article, learn how to use VLOOKUP with 10 practical examples. You also get a free sample workbook to practice VLOOKUP.

Table of Contents

What is VLOOKUP?

VLOOKUP stands for Vertical Lookup. We can use it scan your data to find a matching value. 

You can use the below syntax to write VLOOKUP.

				
					'SYNTAX

=VLOOKUP(search_value, in_this_data, return_column_number, approximate_match_ok?)
				
			
  • Search_value: this is the first parameter or option for VLOOKUP. You can specify the lookup value here. It can be a typed-in value or reference to a cell value.
  • In_this_data: This is where your data is. It can be on the same worksheet or in another tab. It can be a range of values (like B5:E17) or a table (like tblSales).
  • return_column_number: This number tells VLOOKUP which column to extract after the result is found. Refer to below examples to better understand this.
  • approximate_match_ok? This TRUE / FALSE setting tells VLOOKUP if you want an approximate or exact match for your search. In 99% of situations, I use FALSE for this, as we need EXACT matches in business situations.

VLOOKUP Explanation

Here is a simple VLOOKUP to get the sales value of Josh from my sales data in the range $B$5:$E$17. The formula returns the result of $1680. 

Refer to below image to understand the concept of VLOOKUP.

vlookup-example-with-explanation
				
					'SYNTAX

=VLOOKUP(search_value, in_this_data, return_column_number, approximate_match_ok?)


'EXAMPLE
=VLOOKUP("Josh", $B$5:$E$17,3,FALSE)

'RESULT
1680
				
			

EXPLANATION
Vertically looks up “Josh” in column B of the range B5:E17 and returns the exact matching value from column D (3rd column from B). Refer to the above picture and syntax to understand the concept.

VLOOKUP - 5 Essential Examples

Now that you understand the concept of VLOOKUP, let’s look at 5 essential examples of this lookup function in day-to-day business settings.

Note: All these examples use the same sales dataset as above. You can grab a copy of this file from here.

vlookup-5-essential-examples

Example 1 - Basic Usage of VLOOKUP

The most basic usage of VLOOKUP is to lookup a value in a table and get corresponding matching value from another column.

In this example, we want to lookup sales of “Josh” from the sales data in the range B5:E17. 

 

				
					'EXAMPLE 1

=VLOOKUP("Josh", $B$5:$E$17,3,FALSE)

'RESULT
1680
				
			

Example 2 - Using Input Cell for Search Value

One simple way to make your VLOOKUP formulas powerful is by using input cell to maintain the search value. This way, everytime you need to search for a different thing, you just update the search value.

				
					'EXAMPLE 2
'Put a person's name in cell G8, such as Jagjit

'Formula:
=VLOOKUP(G8,$B$5:$E$17,4,FALSE)

'RESULT
709
				
			

Example 3 - Searching by pattern (name begins with)

Many times, we don’t know what the full value is. We just know the first few letters. For example, looking at the sales data in range B5:E17, you want to find the sales of the person whose name begins with the value in cell G5.

For example, G5 contains Jav

In this case, we are looking for the person Javed.

vlookup-with-wild-cards-example
				
					'EXAMPLE 3
'Type Jav in G5

'Formula:
=VLOOKUP(G5&"*",$B$5:$E$17,3,FALSE)

'RESULT
$2277
				
			

How this “Name begins with” VLOOKUP works?

  • The formula is =VLOOKUP(G5&”*”,$B$5:$E$17,3,FALSE)
  • First let’s look at the search_value option. This is G5&”*”
  • As G5 is “Jav”, this becomes Jav*
  • * is a special character for VLOOKUP. It means, anything after Jav.
  • So VLOOKUP looks for any name that begins with Jav and finds Javed. 
  • The rest is easy to understand.

POP QUIZ…

  • How would you find Net Sales for the person whose name ends with sh
  • Write a formula for that and share your answers in the comment section.

Example 4 - Get the entire record

Let’s say you want the entire record, not just Net Sales column (3). In this case, you can use an array as the 3rd parameter for VLOOKUP. See this powerful example.

				
					'EXAMPLE 4
'Get entire record for Johnson

'Formula:
=VLOOKUP("Johnson",$B$5:$E$17,{1,2,3,4},FALSE)

'RESULT
The entire row of values for Johnson
Johnson	10	$1,540 	$570 

				
			

Note about using this formula:

  • If you have Excel 365 or using Excel on the web, the above formula works as is.
  • If you are using any older version of Excel (such as Excel 2016 / 2013 / 2010), then you should do the below steps:
    • Select a range of 4 cells for your result.
    • Type the formula in the very first cell.
    • Then instead of pressing ENTER, press CTRL+SHIFT+ENTER

Example 5 - When VLOOKUP can't find the value...

Life would be just awesome if we can always find what we want. Sadly, that is not the case. So what happens when VLOOKUP can’t find the value you want to look for?

It will return an error. #N/A error.

See below example. Read on to learn how to fix the problem.

				
					'EXAMPLE 5
'Looking for an non-existent value

'Formula:
=VLOOKUP("Chandoo", B5:E17,2,FALSE)

'RESULT
#N/A

				
			

How to fix the #N/A error in VLOOKUP?

We can use the IFERROR function of Excel to handle errors with our VLOOKUP FORMULAS.

For example, you can use this formula to show a message like “Person not found” for the Example 5 above.

				
					'EXAMPLE 5 with error handling
'Looking for an non-existent value

'Formula:
=IFERROR(VLOOKUP("Chandoo", B5:E17,2,FALSE), "Person not found")

'RESULT
Person not found

				
			

How to use VLOOKUP when you have data in a table?

VLOOKUP works great with data in tables or regular ranges. I prefer using VLOOKUP with table data as tables are easier to manage business data.

Related: Learn how to create and use Excel Tables

Here are 3 examples of using VLOOKUP with CTRL+T Tables in Excel.

 

vlookup-with-table-data-3-examples
				
					'VLOOKUP TABLE EXAMPLES
'Data is in table named tblSales

'Formula:
=VLOOKUP("Josh",tblSales,3,FALSE)
'Result:
$1680

'Formula
=VLOOKUP(G37,tblSales,3,FALSE)
'Result
$1799

'Formula
=VLOOKUP(G41&"*",tblSales,3,FALSE)
'Result:
$2277

				
			

Learn more about tables in Excel:

VLOOKUP - Video Tutorial

Please refer to below video tutorial to understand how to use VLOOKUP.

(See it on YouTube directly)

Download VLOOKUP Examples - Workbook

Please download the sample workbook for this article and learn how to use VLOOKUP quickly.

What are the limitations of VLOOKUP?

While VLOOKUP is a game changer when it was originally introduced, when you look at the data challenges we all face in 2024, it suffers from many limitations. Here are the main downsides of using VLOOKUP.

vlookup-limitation-cannot-go-left
  • It can only lookup on the left-most column: VLOOKUP can only search on the data in left-most column of the table and return values to the right. So, if you want to find out the sales person’s name who has sales of $2,133, we can’t do that with VLOOKUP.
  • Column Numbers: Let’s be real. Nobody refers to their data by column numbers. We think and memorize the data by what it is. So, if I want to lookup a name and get the corresponding sales, then I must translate the sales to column number for VLOOKUP. This is lame. 
  • No Error handling:  VLOOKUP doesn’t handle errors by itself. So if your lookup cannot find the value, it just comes back with #N/A. This often has a cascading effect on the charts, dashboards or reports you create.
    • We can use either XLOOKUP or IFERROR to solve this problem.
  • Approximate Trap: I can’t tell you how many times I accidentally leave the last parameter of VLOOKUP out and end up getting wrong results. This is because, if you forget to say FALSE at the end of VLOOKUP, you fall into the approximate trap. Your VLOOKUP RESULTS WILL BE WRONG.
    • We can use XLOOKUP or be careful when writing VLOOKUPS.

My top 3 Alternatives for VLOOKUP

Let me be honest here. As of 2024, I no longer use VLOOKUP to solve my lookup problems in Excel. I use one of these alternatives depending on the nature of the job.

  1. XLOOKUP:  Ever since XLOOKUP was launched a few years ago, it has become my go to lookup formula. It can do everything VLOOKUP does and adds many time-saving features.
    • XLOOKUP can lookup both vertically or horizontally.
    • XLOOKUP defaults to exact match all the time.
    • It can lookup on any column and return another column (thus fixing the left column only limitation of VLOOKUP)
    • It has built-in error handling mechanism.
    • It works well with new Dynamic Array world of Excel.
  2. Power Query: We can use the MERGE Queries functionality of Power Query to lookup and get matching values for two tables quickly and efficiently. I mention this in my recent video here
  3. Power Pivot: If you have two tables each holding one piece of a data puzzle and you want to answer business questions by combining both datasets, we can use Power Pivot’s relationship feature. This automatically connects both tables and let’s you synthesize data to answer queries. Learn how to use Power Pivot to replace VLOOKUPs.

In conclusion: Should you learn and use VLOOKUP?

As mentioned above, I no longer actively use VLOOKUP for my lookup problems. That said, it is a very useful formula and I recommend everyone to learn the basic syntax at the minimum.

  • If you use Excel 365 or Excel on Web: Focus on learning XLOOKUP instead.
  • If you also work in Power BI: Learn how to use Power Query and Power Pivot to replace LOOKUPS in your data.
  • If you work with older versions of Excel: Then VLOOKUP is a must for you. Learn and use it well.

More information on VLOOKUP

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

35 Responses to “Skip weekends while autofilling dates in excel”

    • Foodie says:

      Hi,
      Is there any way that I will choose which are my "working days"?
      means, I want to leave also Friday as a free day and not only Saturday.
      Or, maybe someday I will pick Tuesday as a day off.

      • Mihai says:

        I need to also peek Wednessday, Thursday and Friday as days off. Also, for Tuesday, I would need to leave it off once every two weeks. Is there a way to easy achieve this, so that I won't actually add to my workload?

  1. Deep says:

    Hi,

    I am using MS Office 2007 and for some reason, it does not show me these options. It just shows me 3 options:

    Copy Cell (Not sure about the exact text)
    Copy with Formatting
    Copy without Formatting

    Any idea how to get those options up?

    Regards,
    Deep

  2. Chandoo says:

    @Deep : I am not so well versed with 2007, but here is how you can do this using menus:

    enter first date of the series
    select the range you want to fill
    go to menu > edit > fill > series
    in the dialog, select date as the series type and "weekdays only" option
    press ok...

    Let me know if this doesnt work...

  3. Deep says:

    Now that was FAST!!!

    I tried it but unfortunately it didn't work..

    Here is the screenshot:

    http://img291.imageshack.us/img291/6573/excelsheetyr2.gif

    This is what I tried..

    I put the date in one row, in another row, added some calculations (as you can see in the image) and drag the content in other rows..

    I could not find any Edit menu so i just clicked on the icon as you have shown in the 2nd image..

    I hope I did the right thing...

  4. Chandoo says:

    Hmm...
    there should be an edit menu as far as I know. Let me check that...

    meanwhile... if it works you can use formulas to fill the series.

    1. just enter the first date
    2. in the 2nd row, enter a formula like =if(weekday(firstdatecell,2)=6,firstdatecell+2, firstdatecell+1)
    3. copy the formula over the rest of the range...

  5. Robert says:

    @Deep:

    you have to use the autofill handle, the small box at the lower right of the active cell. Right click on the autofill handle and drag down to the cells you want to autofill. A menu pops up showing the weekdays only option and others.

  6. Deep says:

    @Chandoo - Thanks but it did not work with my calculations. 🙁

    @Robert - Yes, it worked this time but I guess, in my case it won't work as I want to add up the days from the column on the left. (As shown in the image)

    Basically this is what I want:

    1. I want to define project start date
    2. There are no. of days assigned for each module
    3. I want excel to calculate the date automatically. (By adding up the no. of days and deducting the weekends)

    Any kind of help is appriciated.

    Reagrds,
    Deep

  7. Robert says:

    @Deep,

    sorry, I misunderstood your question, I thought you would be searching for the autofill-function only (values).

    If I got your request corrctly now, you could use the WORKDAY-function, returning the date before or after a specified number of workdays.

    In Excel 2003 and earlier the Add-In Analysis Toolpak has to be installed, but since you are using 2007, it should work immediately.

  8. Chandoo says:

    @Deep.. as Robert suggested, Workday is what you should be using. It will calculate future date based number of working days you want to add to input date. Also, you can use this with your own list of holidays.

  9. Deep says:

    Thanks Robert, Chandoo.. I will try the things.. 🙂

  10. Deep says:

    I tried it and this time it worked.. Thanks to both of you.. you guys made my life much more easier 🙂

  11. [...] You can also customize excel lists so that you can auto-fill, lets say bank holidays in your country or types of beer in your pub. One more auto fill trick. [...]

  12. ibabs says:

    Hello,
    I understand how to turn off the weekend values for a date fill in a regular auto fill. But, what if you are trying to create a custom one, that counts the amount of days in the formula bar, like 2 days, then 5 days, then 1 day etc etc etc, but they must be working days only and they must not include the weekends.
    can that be done?
    thanks!

  13. rem says:

    hi..
    i'm using excel 2007
    I'm trying to insert current date automatically
    then it suppose not to change after i save and open it on the next day.I need it to stay on the issued date.
    i'm using Today function and it is not well work 4 me.
    anybody can help to resolve my prob here?
    please...

  14. Cheng says:

    Hi guys,

    How about if I just wanna fill up with weekend? The way I am doing now is using the function weekday and use filter to get weekend. Would appreciate if any one comes up with a better idea. Thank you very much.

    Regards
    Cheng

  15. Kathy says:

    What happened to being able to indicate the series by adding a few cells and then using the autofill to copy? I can't get this to work - I need 4 rows with the same date skipping weekends.

    2/6/2012
    2/6/2012
    2/6/2012
    2/6/2012
    2/7/2012
    2/7/2012
    2/7/2012
    2/7/2012
    2/8/2012
    2/8/2012
    2/8/2012
    2/8/2012
    2/9/2012
    2/9/2012
    2/9/2012
    2/9/2012

    • Kamlesh says:

      Hi Kathy, sorry for a late comment. However, here's the solution.
      1.) put your 1st desired date in the 1st 4 cells required (e.g. <cell A1:A4> 2/6/2012)
       
      2.) put the following formula as is in the following four cell (i.e. A5:A8)
       
      =IF(WEEKDAY(A1,2)=5,A1+3, A1+1)
      =IF(WEEKDAY(A2,2)=5,A2+3, A1+1)
      =IF(WEEKDAY(A2,2)=5,A2+3, A1+1)
      =IF(WEEKDAY(A2,2)=5,A2+3, A1+1)
       
      Note: "=5" denotes the number of working days in the week
       
               "+3" denotes the number of days on weekends.
               "+1" last denotes the number of days after the working date.
       
      3.) Finally, select cells A4:A8 and then drag drown for furthur dates. The formula will skip Saturday & Sunday in the dates.
       
      Let me know, if you want to tweak the formula as per other ways.

      • Mike says:

        Kamlesh: Thanks for the formula. That was what I was looking for. It works the same in Google Docs Spreadsheets. At first I thought it didn't and did some unnecessary tweaking to make it work.

        I was confused by the "IF(WEEKDAY(A2,2)" the modifier 2. I took it out and surpise, the formula didn't work right. I changed the 5 to 6 and then it worked. Turns out, (you probably know this) the default week starts with Sunday. Using 2 makes it start with Monday.

        Any way, I didn't know about the Weekday function. Thanks for sharing this post.

      • salah says:

        Hi, Kamlesh, before i was using "workday" instead of "weekday" but it didn't work.

        thanks for sharing the right formula.

  16. At this moment I am going to do my breakfast, when having my breakfast
    coming yet again to read further news.

  17. sagari says:

    Hi,
    I'm using excel 2007
    I'm trying to calculate a workday

    4 nov 2014(a1) to 12 nov 2014(a2)

    Normally i'm using Int formula to do this
    =int(a2)-int(a1)

    But, hey thats including weekend too... 😀
    how do you calculate workday with this condition ?
    and if there is not only those day, i mean in a month or two

    Thanks before
    sagari

    • Hui... says:

      @Sagari
      =NETWORKDAYS.INTL(DATE(2014,11,4),DATE(2014,11,12),1)
      =7

      You can also include holidays into the formula by having a list of holidays in say A1:A10
      Then use
      =NETWORKDAYS.INTL(DATE(2014,11,4),DATE(2014,11,12),1,A1:A10)

  18. Vikram says:

    Hi
    i had a query while making a template for one of my school daily task.
    Most of the work in these template includes copy from webpage and paste in the template.

    so the problem here is, whenevr me or my mates try to do ctrl+v
    the format of the cell changes automatically.

    I suggested them to use ctrl+alt+v (text) to paste
    but they are not ok with it. they want me to make template in such a way that it should work with normal ctrl +v

    Any ideas guys ?

  19. Brigitte says:

    Our working week is Tuesday to Saturday if I wish to make a sheet solely using those days is there a formula I can use ?

  20. Balaji Mehtre says:

    I need your support for date.
    I wand to numbering actual working date based on date
    below is expected result... so how can apply formula to get number automatically... please help me get resolve this problem... many thanks in advanced.

    1 8/1/2018
    2 8/2/2018
    3 8/3/2018
    8/4/2018
    8/5/2018
    4 8/6/2018
    5 8/7/2018
    6 8/8/2018
    7 8/9/2018
    8 8/10/2018
    8/11/2018
    8/12/2018
    9 8/13/2018
    10 8/14/2018
    11 8/15/2018
    12 8/16/2018
    13 8/17/2018
    8/18/2018
    8/19/2018
    14 8/20/2018
    15 8/21/2018
    16 8/22/2018
    17 8/23/2018
    18 8/24/2018

  21. Salauddin says:

    Dear Sir,

    I want to make a series of December month which will show all the dates without Fridays.

    Is it Possible sir??

    • Chandoo says:

      Interesting question Salauddin... The built-in options in Excel can't generate dates like this. But you can use simple formulas to make up such a series.

      In first cell (say A1) write the starting date (1-Dec-2019 for example). Makesure this date is not a Friday.
      In the next cell (A2) write =WORKDAY.INTL(A1,1,16)
      Now drag down the A2 cell to fill up dates. Stop when you reach the end of your range of dates.

      If your Excel doesn't have WORKDAY.INTL(), then use the below alternative formula.
      =A1+1+(WEEKDAY(A1)=5)

  22. Salauddin says:

    Thank you, Thank you very much sir. it worked perfectly & I was expecting something like that.

  23. michael says:

    i want to make a template with date that skips fortnightly is it possible in excel

  24. krishna says:

    Hi Chandoo, I need to skip weekends from a specified list of dates.
    from the below information I want to pick only the weekdays amount only along with lookup which has builder name separately.

    Date Builder Units Amount
    06-Jan-08 Doug 8 389
    09-Feb-08 Dave 10 385
    15-Mar-08 Dave 3 771
    18-Apr-08 Brian 5 313
    05-May-08 Larry 10 574
    22-May-08 Rob 8 730
    25-Jun-08 Morgan 4 471
    15-Aug-08 Jones 1 548
    12-Dec-08 Doug 3 323
    10-Apr-09 Dave 5 712
    14-May-09 Dave 9 432
    10-Sep-09 Brian 6 460
    31-Oct-09 Larry 3 741
    18-Sep-08 Rob 8 580
    25-Nov-08 Doug 6 685
    29-Dec-08 Dave 2 401
    24-Mar-09 Dave 10 342
    04-Jul-09 Brian 8 475
    21-Jul-09 Larry 3 535
    07-Aug-09 Rob 3 663
    26-Feb-08 Gill 10 762
    22-Oct-08 Jones 5 425
    08-Nov-08 Doug 1 639
    27-Apr-09 Dave 4 409
    27-Sep-09 Dave 4 612
    01-Sep-08 Brian 6 688
    17-Jun-09 Larry 10 663
    24-Aug-09 Rob 5 608
    23-Jan-08 Morgan 6 388

  25. Lynn says:

    Thank you! I've been struggling with this for ages and today, thanks to this post, I finally figured that I had to customize my toolbar in order to utilise the "Fill" menu. This will make my monthly reports much, much neater

Leave a Reply