Match two lists, skip #N/A, return list of matches

mrhoden

New Member
Joined
Mar 5, 2016
Messages
10
G'day everyone,

I am trying to compare two lists of students with the aim of returning a list of matches. The first list is in the array B8:B99 (with some blanks at the bottom) and the second list in found at D8:D99. The matches rarely occur on the same row. I'm trying to list the matches from B108:B199. In this case, Cell B107 tells us that there are 17 matches, but the formula pasted below tells us the matches occur after several #N/As. I'm hoping somebody might be able to tell me how to skip the #N/As in my new list. Here is what I have so far in B108:

HTML:
=IF(ROWS(B$108:B108)>B$107,"",INDEX(B$8:B$100,SMALL(IF(MATCH(B$8:B$100,D$8:D$100,0),ROW(B$8:B$100)-ROW(B$8)+1),ROWS(B$108:B108))))

This returns #N/A because the match function returns this:

HTML:
=IF(ROWS(B$108:B108)>B$107,"",INDEX(B$8:B$100,SMALL(IF({#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;#N/A;26;27;28;29;30;31;32;33;34;35;36;37;38;39;40;41;42;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43;43}),ROW(B$8:B$100)-ROW(B$8)+1),ROWS(B$108:B108))))

Any help here would be greatly appreciated.

Marty
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try wrapping your MATCH in an ISNUMBER function. Also, something looks off on your ROWS function. Since your data starts on row 8 seems like the ROWS(B$108:B108) should be ROWS(B$8:B8).

=IF(ROWS(B$108:B108)>B$107,"",INDEX(B$8:B$100,SMALL(IF(ISNUMBER(MATCH(B$8:B$100,D$8:D$100,0)),ROW(B$8:B$100)-ROW(B$8)+1),ROWS(B$108:B108))))
 
Upvote 0
Another way. I assumed data in B2 and down and D2 and down, then array entered in F2.
Code:
=IFERROR(INDEX($D$2:$D$13,SMALL(IF(ISNA(MATCH($D$2:$D$13,$B$2:$B$13,0)),"",ROW($D$2:$D$13)-MIN(ROW($D$2:$D$13))+1),ROWS($2:2))),"")


A
B
C
D
E
F
1
List 1​
List 2​
Common​
2
Tomato​
Beans​
Cabbage​
3
Peas​
Corn​
Apple​
4
Pear​
Cabbage​
Peas​
5
Celery​
Apple​
Celery​
6
Banana​
Peas​
Banana​
7
Celery​
Lettuce​
8
Lettuce​
Banana​
9
Apple​
Carrots​
10
Cabbage​
Watermelon​
11
Kiwi​
Peach​
12
Lettuce​
13
Pineapple​
 
Upvote 0
Try wrapping your MATCH in an ISNUMBER function. Also, something looks off on your ROWS function. Since your data starts on row 8 seems like the ROWS(B$108:B108) should be ROWS(B$8:B8).

=IF(ROWS(B$108:B108)>B$107,"",INDEX(B$8:B$100,SMALL(IF(ISNUMBER(MATCH(B$8:B$100,D$8:D$100,0)),ROW(B$8:B$100)-ROW(B$8)+1),ROWS(B$108:B108))))

Supposing that B107 houses a count (by a formula), the first instance of this formula augmented with ISNUMBER can be implemented in B108 with no problems at all. It would be a coherent way to do the anchoring.
 
Upvote 0
Try wrapping your MATCH in an ISNUMBER function. Also, something looks off on your ROWS function. Since your data starts on row 8 seems like the ROWS(B$108:B108) should be ROWS(B$8:B8).

=IF(ROWS(B$108:B108)>B$107,"",INDEX(B$8:B$100,SMALL(IF(ISNUMBER(MATCH(B$8:B$100,D$8:D$100,0)),ROW(B$8:B$100)-ROW(B$8)+1),ROWS(B$108:B108))))

Worked perfectly. Thanks very much for your help!
 
Upvote 0

Forum statistics

Threads
1,215,988
Messages
6,128,146
Members
449,427
Latest member
jahaynes

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