showing multiple results with VLookup between two spreadsheets

Holley

Board Regular
Joined
Dec 11, 2019
Messages
155
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Thanks again as always for all your past help! I come to you once again in hopes of resolving an Excel issue. I know it can be done… I just cannot figure it out. I have two spreadsheets. Spreadsheet 1 contains multiple PO#s in Col B (It does not provide me with the invoice #). Spreadsheet 2 contains invoice #s in col A and their corresponding PO # in Col B. What I am trying to figure out is how to use VLookup on Spreadsheet 1 to show me each occurrence of the invoice # that shares the same PO between the two spreadsheets. Maybe another formula would be better?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,
There are several possibilities ... Array Formula will perform what you expect :
Thanks for your quick reply. I may be overlooking, but I don't see where it is comparing the data from two separate workbooks.
 
Upvote 0
Since your invoice numbers are to the left of the PO's on sheet2 you would not be able to use VLOOKUP.
Assuming you could have multiply invoices per PO Try:
Book1
ABCDE
1PO,sInvoices
2PO1IN11IN13 
3PO2IN12  
4PO3   
5PO4IN14  
6PO5IN15  
7PO6IN16IN18 
8PO7IN17  
9PO8   
10PO9IN19  
Sheet1
Cell Formulas
RangeFormula
C2:E10C2=IFERROR(INDEX(Sheet2!$A$2:$A$10,AGGREGATE(15,6,(ROW(Sheet2!$A$2:$A$10)-ROW(Sheet2!$A$2)+1)/(Sheet2!$B$2:$B$10=$B2),COLUMNS($C$1:C1))),"")


Sheet2
Book1
AB
1InvPO,s
2IN11PO1
3IN12PO2
4IN13PO1
5IN14PO4
6IN15PO5
7IN16PO6
8IN17PO7
9IN18PO6
10IN19PO9
Sheet2
 
Upvote 0
If you are just wanting to pull the data (not needing it for a full vlookup function), you can try EZ VLookup. The free version lets you use the Search All function across multiple workbooks. It brings up all instances of that one search criteria.

-EDIT-
Though you can refrence different workbooks exactly the same way with Vlookup. Instead of clicking on a range in the current workbook, just click on a range in the second workbook when selecting where to search.
 
Upvote 0
If you are just wanting to pull the data (not needing it for a full vlookup function), you can try EZ VLookup. The free version lets you use the Search All function across multiple workbooks. It brings up all instances of that one search criteria.

-EDIT-
Though you can refrence different workbooks exactly the same way with Vlookup. Instead of clicking on a range in the current workbook, just click on a range in the second workbook when selecting where to search.
Unfortunately, we cannot use other software, but this looks very interesting, thanks for sharing!
 
Upvote 0
Since your invoice numbers are to the left of the PO's on sheet2 you would not be able to use VLOOKUP.
Assuming you could have multiply invoices per PO Try:
1681144862402.png

This looks to be exactly what I need. is this reading from two separate Spreadsheets? File A and File B? I'm not following the formula.
 
Upvote 0
Thanks for your quick reply. I may be overlooking, but I don't see where it is comparing the data from two separate workbooks.
In your title you mention "worksheets" ... in your latest message "workbooks" ...

Just be re-assured all formulas will produce the results you expect ... since where data is located is a matter of adequate address ...
 
Upvote 0
The example is on worksheets in the same workbook. If you have 2 different workbooks you just need to reference them in the address.
In the formula (ROW(Sheet2!$A$2:$A$10)-ROW(Sheet2!$A$2)+1) this just returns the row numbers (1-9 in the example) in the workbook or sheet that has the invoices.
(Sheet2!$B$2:$B$10=$B2) returns a TRUE or FALSE if it finds a match for the PO.
So, together (ROW(Sheet2!$A$2:$A$10)-ROW(Sheet2!$A$2)+1)/(Sheet2!$B$2:$B$10=$B2) they return the rows that match the PO.
AGGREGATE(15,6 tells the aggregate function to use the SMALL option (#15) and to ignore (#6) errors.
COLUMNS($C$1:C1) as you drag the formula across the columns it for return 1,2,3...etc for the SMALL function.
So, that whole thing will tell the INDEX which row numbers it should use to return the invoices #'s.
You will need to change the cell #'s and sheet or workbook reference to match your data.
You can just drag (not copy) the formula down and across as needed.
 
Upvote 0
The example is on worksheets in the same workbook. If you have 2 different workbooks you just need to reference them in the address.
In the formula (ROW(Sheet2!$A$2:$A$10)-ROW(Sheet2!$A$2)+1) this just returns the row numbers (1-9 in the example) in the workbook or sheet that has the invoices.
(Sheet2!$B$2:$B$10=$B2) returns a TRUE or FALSE if it finds a match for the PO.
So, together (ROW(Sheet2!$A$2:$A$10)-ROW(Sheet2!$A$2)+1)/(Sheet2!$B$2:$B$10=$B2) they return the rows that match the PO.
AGGREGATE(15,6 tells the aggregate function to use the SMALL option (#15) and to ignore (#6) errors.
COLUMNS($C$1:C1) as you drag the formula across the columns it for return 1,2,3...etc for the SMALL function.
So, that whole thing will tell the INDEX which row numbers it should use to return the invoices #'s.
You will need to change the cell #'s and sheet or workbook reference to match your data.
You can just drag (not copy) the formula down and across as needed.
Not sure what I am doing wrong. I'm not getting any data. There should always be at least one invoice. Here is a snippet from File A Maybe it will help make more sense.
1681153630725.png

I put the formula in Q2 and dragged it over to U2 but retrieved no data.

Here is a snippet from File B that contains the invoice #s and PO#s.
1681153801243.png
 

Attachments

  • 1681153210693.png
    1681153210693.png
    7 KB · Views: 7
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top