I can use SUMPRODUCT to check IF a range of values exists in another range; how do I extract them into another list?

SleightOfHand

New Member
Joined
Jun 19, 2020
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Book1
ABCDEFGHIJKL
1Station 1Station 1Station 2Station AStation BStation C
2Station 2
3Station 3
4Station 4
5Station 51
6Station 6
7Station 7
8Station 8
9
10
Sheet1
Cell Formulas
RangeFormula
D5D5=IF(SUMPRODUCT(--(A1:A8=E1:I1))>0,1,0)


I've used a formula to determine whether the stations from I1 are matched in in any case with the column A1:A7. But this just tells me that these exist; how, for a longer list, would I be able to tell WHAT the actual values that match would be?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Welcome to the forum!

Try:

Book1
ABCDEFGHI
1Station 1Station 1Station 2Station AStation BStation C
2Station 2
3Station 3
4Station 4Matches
5Station 51Station 1
6Station 6Station 2
7Station 7 
8Station 8 
Sheet4
Cell Formulas
RangeFormula
D5D5=IF(SUMPRODUCT(--(A1:A8=E1:I1))>0,1,0)
E5:E8E5=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$1:$A$8)/ISNUMBER(MATCH($A$1:$A$8,$E$1:$I$1,0)),ROWS($E$5:$E5))),"")
 
Upvote 0
Welcome to the forum!

Try:

Book1
ABCDEFGHI
1Station 1Station 1Station 2Station AStation BStation C
2Station 2
3Station 3
4Station 4Matches
5Station 51Station 1
6Station 6Station 2
7Station 7 
8Station 8 
Sheet4
Cell Formulas
RangeFormula
D5D5=IF(SUMPRODUCT(--(A1:A8=E1:I1))>0,1,0)
E5:E8E5=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$1:$A$8)/ISNUMBER(MATCH($A$1:$A$8,$E$1:$I$1,0)),ROWS($E$5:$E5))),"")

Eric W, you are a gentleman and a scholar. That works!

I don't know why A:A needs to be done -- I've found it be the case when wanting to extract duplicate values with a IF/SMALL/ROW(s) too. Why does the whole thing need to be selected?
 
Upvote 0
The AGGREGATE finds the matching rows, then the A:A just says what column those rows are in.

Glad it works for you! :)
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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