Email:      Pass:    Pass?
Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!

Subscribe for Free Excel tips & more!

Free Excel Forum

Vlookup Question

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

Hi, all,

I need help!

I have Table1 and Table2 in Spreadsheet. In Table2, there are two or more Invoice Number under same Serial Number.
What I wnat is display the Invoice Number as Original Invoice Number in Table1 if Invoice Number in Table2 is different than Invoice Number in Table1 under same Serial Number.
I tried using Vlookup, but it just display the first value found.

Sample data is attached.

Please advise.

View Answers     

Similar Excel Tutorials

Remove Vlookup #N/A Error in Excel
How to remove the #N/A error from Vlookup and replace it with a friendly message or a blank cell. Fix the Vlookup ...
Vlookup on Data with Spaces
How to use the Vlookup function when your data has extra spaces in it. This happens when the lookup data is import ...
How to use Vlookup Across Multiple Worksheets in Excel
This tutorial shows you how to use the Vlookup function across multiple worksheets within Excel.  This means that y ...
How to use the Vlookup Function in Excel
Full explanation of the Vlookup function in Excel, what it is, how to use it, and when you should use it. The Vlook ...

Helpful Excel Macros

Basic Web Query in Excel - Import Data from the Web into Excel
- Import data from the web into Excel with this macro. This is a basic web query macro that will import data from any web
Vlookup Function That Searches The Entire Workbook - UDF
- This UDF is a Vlookup function that searches the entire workbook in Excel. The syntax and usage of the function is exac
Vlookup Macro to Return All Matching Results from a Sheet in Excel
- This Excel Macro works like a better Vlookup function because it returns ALL of the matching results. Run the
Return the ISO Standards Start of the Year in Excel - First Monday of the Year - UDF
- Return the date of the first Monday of any year with this UDF ISO Year function in Excel. This is a really simple and e
Filter Data in Excel to Display Records that Contain a Value Between Two Values - AutoFilter.
- This free Excel macro filters data to display only those records or rows that contain a value between two values. For e

Similar Topics

i create two table ,table1 contains following data.

Table1 item no customer invoice qty DM-1002 EVG 125 500 SS-7002 EVG 126 600 SO-MITB1 EVG 127 300 BUK-1005 BUK 128 300 BUK-1006 BUK 129 500
table2 contains following three headings of data

Table2 customer invoice qty

in table2 i want to get the customer name from first table so i create a simple relation between two tables.
i drag customer from table1 and leave it on table2 and i table2 design view i click customer heading and then in raw sorce i select table1 and in table1 it shows me drop down list of item no not for customer.

please tell me what's going wrong.


Hi, I need a way to select a discontinuous range in VBA with these circumstances:

The data I'm working with is grouped into 5 by 5 regions, each region with a header above it, stacked one above the other with an empty line between each

There are also several "columns" of these tables, although I could put them on separate sheets if that simplifies the code

What I want to do is find the maximum value within a given location in each table. By this, I mean that I will be comparing the value in 1st row in the 1st column of the 1st table with the value in the 1st row in the 1st column of the 2nd table.

I can't seem to upload files here at work, but the tables look something like...

1 2 3 4 5
6 7 8 9 0
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5

6 7 0 9 0
1 2 3 4 5
6 7 0 9 0
6 7 0 9 0
6 7 0 9 0

With the end product being
Table2 Table2 Table1 Table2 Table2
Table1 Table1 Table1 Table1 Table1
Table2 Table2 Table1 Table2 Table2
Table2 Table2 Table1 Table2 Table2
Table2 Table2 Table1 Table2 Table2

Thanks in advance, sorry for the mess

For example, on sheet1 there is table1 (A10:G11) and on sheet2 there is table2 (A1:I20). For every row table1 has, I want table2 to copy data from table2 (A1:I20) and add it to the bottom of table2 making table2 now (A1:I40) when table1 is (A10:G12).

Thank you

SELECT Table1.Field4, [Table2].Field1, [Table2].Field2, [Table2].Field3
FROM Table1 INNER JOIN [Table2] ON Table1.Field4 = [Table2].Field4;

Thanks for any help. I'd like to be able to edit the display and have any
changes (or deletions) reflected in Table2.

I've got a worksheet with several tables, each of which I've assigned a defined name. At the top of my worksheet I have several cells containing lookup functions, and these are repeated for each defined table on the sheet.

Right now I'm creating all my lookup functions for a single table, copying the cells containing these functions, and editing the references to the defined names in the copies by hand, giving me a final product something like this:


                      A                       B                      C                      D
2                    10                      10                     10                     10
3 =VLOOKUP(A$2,Table1,2) =VLOOKUP(B$2,Table2,2) =VLOOKUP(C$2,Table3,2) =VLOOKUP(D$2,Table4,2)
4 =VLOOKUP(A$2,Table1,3) =VLOOKUP(B$2,Table2,3) =VLOOKUP(C$2,Table3,3) =VLOOKUP(D$2,Table4,3)
5 =VLOOKUP(A$2,Table1,4) =VLOOKUP(B$2,Table2,4) =VLOOKUP(C$2,Table3,4) =VLOOKUP(D$2,Table4,4)
6 =VLOOKUP(A$2,Table1,5) =VLOOKUP(B$2,Table2,5) =VLOOKUP(C$2,Table3,5) =VLOOKUP(D$2,Table4,5)

To get this result, I'd normally do all the formulas in Column A first, then copy these formulas to Columns B-D, but doing that gives me the result below:

                      A                       B                      C                      D
                      A                       B                      C                      D
2                    10                      10                     10                     10
3 =VLOOKUP(A$2,Table1,2) =VLOOKUP(B$2,Table1,2) =VLOOKUP(C$2,Table1,2) =VLOOKUP(D$2,Table1,2)
4 =VLOOKUP(A$2,Table1,3) =VLOOKUP(B$2,Table1,3) =VLOOKUP(C$2,Table1,3) =VLOOKUP(D$2,Table1,3)
5 =VLOOKUP(A$2,Table1,4) =VLOOKUP(B$2,Table1,4) =VLOOKUP(C$2,Table1,4) =VLOOKUP(D$2,Table1,4)
6 =VLOOKUP(A$2,Table1,5) =VLOOKUP(B$2,Table1,5) =VLOOKUP(C$2,Table1,5) =VLOOKUP(D$2,Table1,5)

As you can see, I still have to go in to Columns B-D and manually correct the table reference names. So, my question is this: is it possible to enter the text values Table1, Table2, etc. in Row 1, and somehow have all my vlookup functions extract the name of the table to use from these cells? I know I can't just do something like having the formula in A3 =VLOOKUP(A$2,A$1,2) since that will make the formula think that the range A1 itself is where I want to do the lookup. Any ideas?

Hey Guys I Have I Q

I'd Like To Make To Make Every Thing Variable In "Gray Table" So I Can Choose According To My Need I Work

1- Ranges Variables So I Can Choose The Range I Need
2- Look Up Table Variable So I Can Choose Between Tables I need
3- Color Every Range With Specific Color Through Drop Down List Color


  A B C D E F G H I J K L M N O P Q 1 A1 C 700     Range Tables Color   Table1   Table2   Table3 2 A2 C 701   First LookUp A1 A4 Table1 Blue Sky   A1 C 700   A1 Z 500   A1 Y 300 3 A3 C 702   Second LookUp A5 A13 Table3 Red   A2 C 701   A2 Z 501   A2 Y 301 4 A4 C 703   Third LookUp A14 A18 Table2 Yellow   A3 C 702   A3 Z 502   A3 Y 302 5 A5 Y 304               A4 C 703   A4 Z 503   A4 Y 303 6 A6 Y 305               A5 C 704   A5 Z 504   A5 Y 304 7 A7 Y 306               A6 C 705   A6 Z 505   A6 Y 305 8 A8 Y 307               A7 C 706   A7 Z 506   A7 Y 306 9 A9 Y 308               A8 C 707   A8 Z 507   A8 Y 307 10 A10 Y 309               A9 C 708   A9 Z 508   A9 Y 308 11 A11 Y 310               A10 C 709   A10 Z 509   A10 Y 309 12 A12 Y 311               A11 C 710   A11 Z 510   A11 Y 310 13 A13 Y 312               A12 C 711   A12 Z 511   A12 Y 311 14 A14 Z 513               A13 C 712   A13 Z 512   A13 Y 312 15 A15 Z 514               A14 C 713   A14 Z 513   A14 Y 313 16 A16 Z 515               A15 C 714   A15 Z 514   A15 Y 314 17 A17 Z 516               A16 C 715   A16 Z 515   A16 Y 315 18 A18 Z 517               A17 C 716   A17 Z 516   A17 Y 316 19                   A18 C 717   A18 Z 517   A18 Y 317 20                   A19 C 718   A19 Z 518   A19 Y 318 21                   A20 C 719   A20 Z519   A20 Y 319
Spreadsheet Formulas Cell Formula B1 =VLOOKUP(A1,Table1,2,0) B2 =VLOOKUP(A2,Table1,2,0) B3 =VLOOKUP(A3,Table1,2,0) B4 =VLOOKUP(A4,Table1,2,0) B5 =VLOOKUP(A5,Table3,2,0) B6 =VLOOKUP(A6,Table3,2,0) B7 =VLOOKUP(A7,Table3,2,0) B8 =VLOOKUP(A8,Table3,2,0) B9 =VLOOKUP(A9,Table3,2,0) B10 =VLOOKUP(A10,Table3,2,0) B11 =VLOOKUP(A11,Table3,2,0) B12 =VLOOKUP(A12,Table3,2,0) B13 =VLOOKUP(A13,Table3,2,0) B14 =VLOOKUP(A14,Table2,2,0) B15 =VLOOKUP(A15,Table2,2,0) B16 =VLOOKUP(A16,Table2,2,0) B17 =VLOOKUP(A17,Table2,2,0) B18 =VLOOKUP(A18,Table2,2,0)

Excel tables to the web >> Excel Jeanie HTML 4


I have a relatively simple problem but not sure how to solve it.

I have two spreadsheets named Table1 and Table2.

I also have a list of loan numbers in Column A of Sheet 3.

I need a formula that will lookup each loan number in Table1, but if it is not there, then lookup Table2, and return the value found in Column B of either Table1 or Table2. I hope that is clear.

Any help would be apprecaited.



I use excel file for my Invoice. Here I need to move up & down to edit the previous & next invoice. I made to select the invoice number from combo box.

So when I select the Invoice number from combo box that the particular Invoice should be
display. I tried many code but i caqnnot.

Can u please help me?



I am looking for some suggestions on how can I possibly withdraw main data from my Invoice template (like: Invoice number, Name of the customer, total amount) in to another spreadsheet in order for me to create some sort of data base of every invoice that I send to my customers. I also wonder if some how I can auto increase my invoice number? For example if you open new invoice with number 001 so that the second one that you open will be automatically changed on 002 and so on, but with question If you reopen an existing invoice the number should not increase then.

I know that VBA can help but since I do not know anything about VBA I am looking for some help here.

Thanks in advance

I have an invoice sheet and when one job is entered into it I would like a new invoice sheet with the same format to appear while the previous invoice is filed away possibly in another workbook. The jnvoices are all numbered so I'm also attempting to have the invoice number grow by 1 everytime a new automatic invoice is created. Any ideas attached is the invoice for further analysis.

"In Excel 2007, I have a spreadsheet containing invoice line items. Each invoice number is listed multiple times in column A, once for each line item associated. Is there a formula that will number each line of each invoice?


If A2 through A5 = 12345 then I would like B2 = 1, B3 = 2, B4 = 3, B5 = 4. Then start again at 1 for the next invoice number. Each invoice number has a different number of rows so I am hoping for a formula to recognize each number and sequentially number each occurrence within that row.

All help greatly appreciated

i am complete beginner.
i am currently designing an invoice in excel.
i want a macro that will automatically save an invoice worksheet from its invoice number which will clear the sheet for a new invoice with a new invoice number. the worksheet should then be saved in my documents.
how do you create a macro that automatically generate a new invoice number from the previous number. for e.g. 101 going on to 102
i have searched through the forum and found solution but it doesn't work for me.

I am using an Excel based invoice and I want to add a serial number that will
automatically update each time I open a new invoice. Is there an easy way?


I am trying to create a workbook where I can log what work I have done in one spreadsheet and allocate an invoice number to it. In a separate spreadsheet within the same workbook I have created an invoice template. When I enter in the invoice number into the invoice template it's not collecting the correct information.

For example, if I want the details for invoice 10 to show in the invoice template, details for invoice 19 appear.

I have used this formula:
=IFERROR(INDEX(ServiceRecord[[Invoice number]:[Date invoice issued]],SMALL(IF(ServiceRecord[[Invoice number]:[Date invoice issued]]='Invoice TEMPLATE'!$F$8,ROW(ServiceRecord[Invoice number])),ROW(1:1)),2),"")

Does someone mind having a look in to the attachment and letting me know what I have done incorrectly and how I can fix it?

I am wanting to add new information as time goes on and also to be able to put in any invoice number into the invoice template to recall information as needed.

Thank you

Can any body help

I have created a automatic invoice generator which will print the invoice and then clear the invoice and generate the next invoice number

The worksheet consists of 3 spreadsheets Invoice Lookup tables which store the products and clients Invoice list with get a grandtotal of invoice plus key information ie name etc

The Invoice no is situated in cells D1 to E1 but what i would like the macro to do is to copy the invoice only and save it in a directory C:\oldinvoices with a file name of the invoice no ie cells D1 - E1 this will enable me to be able to recreate an old invoice if needs be

I cannot see how this can be done and would appreciate any advise that yon can give me

I have created a few identical sheets, namely Invoice, Invoice (2), Invoice (3) and so on. Cell F5 of each invoice will be the invoice number (running number). After sheet Invoice (3), i have created another sheet namely Invoice Summary (on the right to Invoice (3)), which will have one of the column, says column C to capture invoice number from sheet Invoice, Invoice (2) and Invoice (3) by draging down column C2 to C4 of Invoice Summary sheet:

C2 to reflect invoice number of sheet Invoice
C3 to reflect invoice number of sheet Invoice (2)
C4 to reflect invoice number of sheet Invoice (3)

however, relative sheet reference could not be perform by draging down the fill handle.
How do i solve this?
Thanks in advance!

I am processing invoices and i need to know if the same invoice number has been used in the spread sheet. For example. Invoice number in each cell down a colum. as below
Invoice Number

If the same invoice number is used an alert or dialog box box saying that that number has already been used appears. for example
Invoice Number
4 (when i try to enter or move on from this cell I am made aware the number has already been used.)
Thanks for any help you may be able to provide.

Sorry, I didn't quite know how to word the title .

I have an Excel Invoice Template, saved as a template.

I have code that generates a new invoice number each time the template is opened in VBA Editor. The auto numbering system works great! However.... (here comes the sad part)

After I enter all the data I need on the invoice, I want to save a copy of the invoice in a different file folder, which I can no problem. The problem is, if I re-open the saved invoice, we will call it Invoice #100, excel asks me if I want to update, if I say either yes or no, the invoice number will change to Invoice #101. I'm sure you can see how this can cause a major problem if we need to compare information later on, finding the correct invoice would be almost impossible as it would not match the customers invoice number.

What I need to know is:
Is there code I can add to the existing code, to stop the increment on a saved invoice, but not on the original template?

I have gotten so much information from this site Im so glad it is here and hopefully I can help someone out in the future


I have a spreadsheet I am using to simply record invoice numbers and the times that I completed those numbers. Instead of manually writing the time I recorded the invoice number, is there a way that when I enter the invoice number, the time I entered it will populate in the cell next to the invoice number automatically?

Invoice Number Time 456985 1:59


i am trying to transfer data from one table to another using vlookup function.

If the check box is ticked, this means that this invoice has been paid and returns a TRUE; otherwise, it remains blank or simply indicates a FALSE.

This is the table I am trying to populate to summarize all outstanding items. Currently I am using a vlookup function to do this. The problem is if an invoice for the quarter has been paid in Table1, i have to manually delete the formula in Table2 so as not to show it as outstanding.


I know I can use the TRUE, FALSE and BLANK status in Table1 to make this work more efficient. However, when I tried to do a multiple vlookup function nested in IF, it's not picking any numbers at all.

I thought I'd consult your guidance on this. Any assistance you can extend is truly appreciated.


I've created an invoice form which uses the Invoice number to return the results, there are multiples of the same number, say there could be 4 different lines using invoice number 72. So far I've created my vlookup fields as (First line)

=VLOOKUP(E4,'Invoice Sheet'!A:M,3,0)

and then following, so it doesn't repeat the same line/ and doesn't display #n/a

=IF(VLOOKUP(E4,'Invoice Sheet'!A:M,3,1)

I've been playing around and cannot find a formula for an invoice. What I am after is as follows:
Invoices to looking like: 08-09/01......08-09/02 etc etc. The 08-09 is the current tax year and obviously the munber after is the invoice number. Now what I am trying to do is after I've closed an invoice, say 08-09/02, then when I open up a new excel invoice, the invoice number should automatically change to 08-09/03.
Hope all this makes sense.

Hi ppl,

I am a complete novice so please be patient!

I have a workbook, with 226 seperate sheets enclosed. What I would like to do is to put an invoice number in the first sheet's invoice number cell and then the remaining sheets auto add a 1 to make up the next invoice.

For example, if I were to put 1200 into sheet 1's invoice cell, sheet 2's invoice cell would read 1201 and so on. All invoice cells are in the same place and are in B2.

Until I found this board I have had to do this manually! I know nothing about VB but can bake a nice cake if that will help

Thank you in anticipation of your help.


I have a very simple macro that I found on the internet that increases an invoice number by 1.

Sub NextInvoice()

Range("L1").Value = Range("L1").Value + 1

End Sub

It works great, provided the invoice number is just numbers. But I want to be able to add PF as in PF101425, on some of the invoices, not every invoice, however when I put the PF there the macro does not work.

There is more to the macro than just increasing the invoice number. It also populates other cells on a separate sheet with the information from the invoice and then clears all fields ready for the next invoice. So when I click on the button that triggers the macro the fields are populated correctly, even with the PF in front of the number, it is just the invoice number does not increase by 1.

If anybody can help with this problem it would be appreciated. Thank you.

Hi guys,

the following:

I have one workbook with 3 Sheets (Table1/Table2/Table3). In Table 3 are the following columns "Table1" and "Table2". I need one script which search in table1 and table2 the words from test1 to test15 and write the assign numbers in table 3 in the right columns / row! If one value is not found, this value should have the number 0 in table 3.

I have the following examples attached, file Mappe1_Test1.xlsx is the before status and Mappe1_Test.xlsx should be the after status.

Can you help me out?