Thanks for your reply Aladin!
It seems to work on your sheet but not mine
Is there a difference made if there are some entries which do not match?
For example:
the result is more like this
[TABLE="width: 500"]
<TBODY>[TR]
[TD]1
[/TD]
[TD]q
[/TD]
[/TR]
[TR]
[TD]1a
[/TD]
[TD]r
[/TD]
[/TR]
[TR]
[TD]1b
[/TD]
[TD]s
[/TD]
[/TR]
[TR]
[TD]1d
[/TD]
[TD]t
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]2a
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]a
[/TD]
[/TR]
[TR]
[TD]4a
[/TD]
[TD]b
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]5a
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]5b
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]w
[/TD]
[/TR]
</TBODY>[/TABLE]
Hopefully you don't have any other surprises. Admittedly, it is a nice challenge...
[TABLE="width: 242"]
<COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><COL style="WIDTH: 50pt; mso-width-source: userset; mso-width-alt: 2389" width=67><TBODY>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent"] [/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"] [/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"] [/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"] [/TD]
[TD="class: xl65, width: 67, bgcolor: transparent"] [/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]
1[/TD]
[TD="class: xl66, bgcolor: transparent"]
q[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
1[/TD]
[TD="class: xl66, bgcolor: transparent"]
q[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]
4[/TD]
[TD="class: xl66, bgcolor: transparent"]
a[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
1a[/TD]
[TD="class: xl66, bgcolor: transparent"]
r[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]
1[/TD]
[TD="class: xl66, bgcolor: transparent"]
r[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
1b[/TD]
[TD="class: xl66, bgcolor: transparent"]
s[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]
1[/TD]
[TD="class: xl66, bgcolor: transparent"]
s[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
1d[/TD]
[TD="class: xl66, bgcolor: transparent"]
t[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]
7[/TD]
[TD="class: xl66, bgcolor: transparent"]
w[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
2[/TD]
[TD="class: xl66, bgcolor: transparent"]
-[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]
1[/TD]
[TD="class: xl66, bgcolor: transparent"]
t[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
2a[/TD]
[TD="class: xl66, bgcolor: transparent"]
-[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]
4[/TD]
[TD="class: xl66, bgcolor: transparent"]
b[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
3[/TD]
[TD="class: xl66, bgcolor: transparent"]
-[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
4[/TD]
[TD="class: xl66, bgcolor: transparent"]
a[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
4a[/TD]
[TD="class: xl66, bgcolor: transparent"]
b[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
5[/TD]
[TD="class: xl66, bgcolor: transparent"]
-[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
5a[/TD]
[TD="class: xl66, bgcolor: transparent"]
-[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
5b[/TD]
[TD="class: xl66, bgcolor: transparent"]
-[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
6[/TD]
[TD="class: xl66, bgcolor: transparent"]
-[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl68, width: 64, bgcolor: white"]
7[/TD]
[TD="class: xl66, bgcolor: transparent"]
w[/TD]
[/TR]
</TBODY>[/TABLE]
E2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($B$2:$B$8,SMALL(IF($A$2:$A$8=LEFT(D2&"#")+0,
ROW($B$2:$B$8)-ROW($B$2)+1),
SUM(ISNUMBER(SEARCH(LEFT($D$2:D2),D2))+0))),"-")