Customer Sheet
[TABLE="class: grid, width: 192"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"]A
[/TD]
[TD="width: 64, bgcolor: transparent"]B
[/TD]
[TD="width: 64, bgcolor: transparent"]D
[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]1[/TD]
[TD="width: 64, bgcolor: transparent"]
emp ID
[/TD]
[TD="width: 64, bgcolor: transparent"]
customer
[/TD]
[TD="width: 64, bgcolor: transparent"]
Sub type
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]2[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
AAA A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]3[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
AAA A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]4[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
AAA A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]5[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
BBB A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]6[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
BBB A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]7[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
BBB B
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]8[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
BBB B
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]9[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
BBC A
[/TD]
[TD="bgcolor: transparent"]
N
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]10[/TD]
[TD="bgcolor: transparent"]
AAAA
[/TD]
[TD="bgcolor: transparent"]
BBC A
[/TD]
[TD="bgcolor: transparent"]
N
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]11[/TD]
[TD="bgcolor: transparent"]
BBBB
[/TD]
[TD="bgcolor: transparent"]
CCC A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]12[/TD]
[TD="bgcolor: transparent"]
BBBB
[/TD]
[TD="bgcolor: transparent"]
CCC A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]13[/TD]
[TD="bgcolor: transparent"]
BBBB
[/TD]
[TD="bgcolor: transparent"]
CCC A
[/TD]
[TD="bgcolor: transparent"]
Y
[/TD]
[/TR]
</tbody>[/TABLE]
Employee Sheet
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Emp ID[/TD]
[TD]AAA[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Cutomer ID[/TD]
[TD]Subtype[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]AAA A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]BBB A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]BBB A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]BBB C[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
In A4 of Employee sheet and copy down
This is an array formula and must be committed with CONTROL+SHIFT+ENTER. If done correctly Excel will put {} around the formula.
Code:
=IFERROR(INDEX(Customer!$B$2:$B$13,SMALL(IF(FREQUENCY(IF(ISNUMBER(SEARCH($B$1,Customer!$A$2:$A$13)),MATCH(Customer!$B$2:$B$13,Customer!$B$2:$B$13,0)),ROW(Customer!$B$2:$B$13)-ROW(Customer!$B$1)+1),ROW(Customer!$B$2:$B$13)-ROW(Customer!$B$1)+1),ROWS($A$4:A4))),"")