showing multiple results with VLookup between two spreadsheets

Holley

Board Regular
Joined
Dec 11, 2019
Messages
120
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?
 
1. Please show a copy of the actual formula you entered
2. Are these 2 worksheets in the same workbook or 2 different workbooks?
3. Shouldn't the formula be in P2 and then dragged over and down?
4. I'm assuming the PO# is formatted the same in both files (either both are text or number).
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Thanks so much for your help and patience!!

1. =IFERROR(INDEX([Sheet2]File2!$A$2:$A$19499,AGGREGATE(15,6,(ROW([Sheet2]File2!$C$2:$C$19499)-ROW([Sheet2]File2!$C$2)+1)/([Sheet2]File2!$B$2:$B$10=$A1),COLUMNS($Q$Q1!))),"")
2. They are in two different workbooks.
3. YES! P2 should be where the formula is.
4. Yes, both are formatted GENERAL
 
Upvote 0
Your syntax is wrong.
I named this workbook File A
File A.xlsx
ABCDEFGHIJPQRSTU
1PO #Invoice DateTax/VAT PaymentBusinessInvoice 1Invoice 2Invoice 3Invoice 4Invoice 5Invoice 6
2123453/3/2023316-15.80000300.20Company123201250   
3200563/4/2023124300    
Sheet1
Cell Formulas
RangeFormula
P2:T3P2=IFERROR(INDEX('[File B.xlsx]Sheet1'!$A$2:$A$6,AGGREGATE(15,6,(ROW('[File B.xlsx]Sheet1'!$A$2:$A$6)-ROW('[File B.xlsx]Sheet1'!$A$2)+1)/('[File B.xlsx]Sheet1'!$B$2:$B$6=$A2),COLUMNS($P$1:P1))),"")
U2:U3U2=IFERROR(INDEX('[File B.xlsx]Sheet1'!$A$2:$A$4,AGGREGATE(15,6,(ROW('[File B.xlsx]Sheet1'!$A$2:$A$4)-ROW('[File B.xlsx]Sheet1'!$A$2)+1)/('[File B.xlsx]Sheet1'!$B$2:$B$4=$A2),COLUMNS($P$1:U1))),"")


This workbook named File B (change to the names of your workbooks.
File B.xlsx
ABCDEF
1Inv #Purch OrderInv DateInv $
2123123458/3/2022124.71
3124200568/4/2022124.71
4201123458/5/2022124.71
5300200568/6/2022125.71
6250123458/7/2022126.71
Sheet1

This link will explain the formula.
 
Upvote 0
Thank you! I am still not getting any data output after entering the formula. I will have to watch the video after hours, it is blocked here in the office. Hopefully, I can find my error. Here is a snippet after pasting the formulas as you provided.

1681159567795.png


Formula is File A, Cell P2:T3 =IFERROR(INDEX('[File B.xlsx]Sheet1'!$A$2:$A$6,AGGREGATE(15,6,(ROW('[File B.xlsx]Sheet1'!$A$2:$A$6)-ROW('[File B.xlsx]Sheet1'!$A$2)+1)/('[File B.xlsx]Sheet1'!$B$2:$B$6=$A2),COLUMNS($P$1:P1))),"")

Formula in File A, Cell U2:U3 =IFERROR(INDEX('[File B.xlsx]Sheet1'!$A$2:$A$4,AGGREGATE(15,6,(ROW('[File B.xlsx]Sheet1'!$A$2:$A$4)-ROW('[File B.xlsx]Sheet1'!$A$2)+1)/('[File B.xlsx]Sheet1'!$B$2:$B$4=$A3),COLUMNS($P$1:U2))),"")
 

Attachments

  • 1681159449937.png
    1681159449937.png
    7.5 KB · Views: 1
Upvote 0
One thing I see is my formula in U2 has a wrong range for the example. The range should be A2 - A6 the same as the formula in P2. If you drag the formula in P2 down and across it should have the right ranges for the example. Since you are getting blanks there is an error in the formula or the data. Take the IFERROR part of the formula out to see what error you are getting. Also, if you use the "Evaluate Formula" option under the Formulas ribbon it should show where the error is.
Also, make sure you change the references to match your file names and ranges.. Another thing to check is the PO's in the 2 files. Even though you say they have general format. Check a cell in each file with the ISTEXT function. They both should return either TRUE or FALSE.

Formula without the IFERROR:
=INDEX('[File B.xlsx]Sheet1'!$A$2:$A$6,AGGREGATE(15,6,(ROW('[File B.xlsx]Sheet1'!$A$2:$A$6)-ROW('[File B.xlsx]Sheet1'!$A$2)+1)/('[File B.xlsx]Sheet1'!$B$2:$B$6=$A2),COLUMNS($P$1:P1)))
 
Upvote 0
One thing I see is my formula in U2 has a wrong range for the example. The range should be A2 - A6 the same as the formula in P2. If you drag the formula in P2 down and across it should have the right ranges for the example. Since you are getting blanks there is an error in the formula or the data. Take the IFERROR part of the formula out to see what error you are getting. Also, if you use the "Evaluate Formula" option under the Formulas ribbon it should show where the error is.
Also, make sure you change the references to match your file names and ranges.. Another thing to check is the PO's in the 2 files. Even though you say they have general format. Check a cell in each file with the ISTEXT function. They both should return either TRUE or FALSE.

Formula without the IFERROR:
=INDEX('[File B.xlsx]Sheet1'!$A$2:$A$6,AGGREGATE(15,6,(ROW('[File B.xlsx]Sheet1'!$A$2:$A$6)-ROW('[File B.xlsx]Sheet1'!$A$2)+1)/('[File B.xlsx]Sheet1'!$B$2:$B$6=$A2),COLUMNS($P$1:P1)))
Still working with the formula but now I am getting #NUM error. I haven't had an opportunity to watch the video yet- unfortunately. There are 19499 rows in file B, I would think I would need to adjust the range to $A$2:$A$19499... etc?
 
Upvote 0
Still working with the formula but now I am getting #NUM error. I haven't had an opportunity to watch the video yet- unfortunately. There are 19499 rows in file B, I would think I would need to adjust the range to $A$2:$A$19499... etc?
Could this part be the culprit?

1681242973577.png
 
Upvote 0
Since you are getting an #NUM error would lead me to believe that the PO's in File A and File B are different (which would give all the #Div/0 errors you see.
Open a new wookbook
Copy and paste a PO# from File A into cell A1
Then copy and paste the same PO# from File B into cell B1
In cell C1 enter A1=B1 and my guess is it will show FALSE.

Two things to look for:
1. Are the PO# numeric in one file and text in the other (a cell formatted as General can have both numeric & text).
2. If both are text then look to see if one may have some leading or trailing spaces.
 
Upvote 0
Solution
Since you are getting an #NUM error would lead me to believe that the PO's in File A and File B are different (which would give all the #Div/0 errors you see.
Open a new wookbook
Copy and paste a PO# from File A into cell A1
Then copy and paste the same PO# from File B into cell B1
In cell C1 enter A1=B1 and my guess is it will show FALSE.

Two things to look for:
1. Are the PO# numeric in one file and text in the other (a cell formatted as General can have both numeric & text).
2. If both are text then look to see if one may have some leading or trailing spaces.
GOT DATA! YAY!! You are a lifesafer and GENIUS! THANK YOU SO VERY MUCH!!
 
Upvote 0
You're welcome. Good to hear you got it working (I was running out of ideas). Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,785
Members
449,095
Latest member
m_smith_solihull

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