Need to compare two columns and fetch the matching values in a new column

aghaffar82

Board Regular
Joined
Jun 13, 2019
Messages
65
Office Version
  1. 365
Platform
  1. Windows
Kindly check the attached and advise how can this be achieved. Thank you in advance.

data for question.xlsx
ABCDEFGHIJ
1Value1Value2InvPriceValue1Value2InvPrice
2ABCGHI527.94ABCABC527.94
3GHINone455.94GHIGHI455.94
4DMOPPM455.94PQSPQS284.94
5PQSAGI284.94AGIAGI584.94
6TTPDGS184.94
7AGIPQS584.94
8TOFABC684.94
9
10
11ORIGINAL DATADESIRED RESULT
12.11.20.dups (1)
 
Yes, that's the mistake I made in my original post, I need to match item column (column B & pull the info for inv & price).
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
So, are you all sorted now?
Unfortunately No, the formula is still fetching values from column C & D based on the rows of column A and I need it to fetch them based on the rows of column B. Thank you
 
Upvote 0
So, can you post a new small set of XL2BB sample data and expected results and explain carefully how you manually obtain one or two of the expected results?
 
Upvote 0
Yes Sir, here is the new range: The yellow columns are the original data and the light green columns are the desired results. I just don't want to use VLOOKUP and would prefer a dynamic solution instead. Thank you

data for question.xlsx
ABCDEFGHIJ
1Value1Value2InvPriceValue1Value2InvPrice
2ABCGHI527.94ABCABC684.94
3GHINone455.94GHIGHI527.94
4DMOPPM455.94PQSPQS582.62
5PQSAGI284.94AGIAGI284.94
6TTPDGS194.55
7AGIPQS582.62
8TOFABC684.94
9
10
Sheet1
Cell Formulas
RangeFormula
G2:H5G2=FILTER(INDEX(A:B,SEQUENCE(ROWS(A:B)),{1,1}),ISNUMBER(MATCH(A:A,B:B,0)),"No Data")
I2:I5I2=VLOOKUP(H2,B:D,2,0)
J2:J5J2=VLOOKUP(H2,B:D,3,0)
Dynamic array formulas.
 
Upvote 0
Thanks for the new data & results.

Provided you are not concerned about the order of the results, this should do it with a single dynamic array formula in G2

aghaffar82.xlsm
ABCDEFGHIJ
1Value1Value2InvPriceValue1Value2InvPrice
2ABCGHI527.94GHIGHI527.94
3GHINone455.94AGIAGI284.94
4DMOPPM455.94PQSPQS582.62
5PQSAGI284.94ABCABC684.94
6TTPDGS194.55
7AGIPQS582.62
8TOFABC684.94
9
Match columns (2)
Cell Formulas
RangeFormula
G2:J5G2=FILTER(INDEX(A:D,SEQUENCE(ROWS(A:D)),{2,2,3,4}),ISNUMBER(MATCH(B:B,A:A,0)))
Dynamic array formulas.


However, if the order is important to you then with your existing dynamic array formula in G2, this one in I2 copied across to J2 produces the results you want.

aghaffar82.xlsm
ABCDEFGHIJ
1Value1Value2InvPriceValue1Value2InvPrice
2ABCGHI527.94ABCABC684.94
3GHINone455.94GHIGHI527.94
4DMOPPM455.94PQSPQS582.62
5PQSAGI284.94AGIAGI284.94
6TTPDGS194.55
7AGIPQS582.62
8TOFABC684.94
9
Match columns (3)
Cell Formulas
RangeFormula
G2:H5G2=FILTER(INDEX(A:B,SEQUENCE(ROWS(A:B)),{1,1}),ISNUMBER(MATCH(A:A,B:B,0)),"No Data")
I2:J5I2=XLOOKUP(INDEX($G2#,0,1),$B:$B,C:C)
Dynamic array formulas.


And, as a matter of interest, you mentioned that VLOOKUP was no good as it didn't expand for any extra rows but if used as below in I1 and J2 it will automatically expand/contract if columns G & H do. :)

aghaffar82.xlsm
ABCDEFGHIJ
1Value1Value2InvPriceValue1Value2InvPrice
2ABCGHI527.94ABCABC684.94
3GHINone455.94GHIGHI527.94
4DMOPPM455.94PQSPQS582.62
5PQSAGI284.94AGIAGI284.94
6TTPDGS194.55
7AGIPQS582.62
8TOFABC684.94
9
Match columns (4)
Cell Formulas
RangeFormula
G2:H5G2=FILTER(INDEX(A:B,SEQUENCE(ROWS(A:B)),{1,1}),ISNUMBER(MATCH(A:A,B:B,0)),"No Data")
I2:I5I2=VLOOKUP(INDEX(G2#,0,1),B:C,2,0)
J2:J5J2=VLOOKUP(INDEX(G2#,0,1),B:D,3,0)
Dynamic array formulas.
 
Upvote 0
Thank you so much Sir, works everything perfectly now. You have been very kind and patient with all these steps. Best Regards and a wonderful day ahead.
 
Upvote 0

Forum statistics

Threads
1,215,436
Messages
6,124,869
Members
449,192
Latest member
MoonDancer

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