[Table="width:, class:grid"][tr][td]Row\Col[/td][td]A
[/td][td]B
[/td][td]C
[/td][td]D
[/td][td]E
[/td][td]F
[/td][td]I
[/td][td]J
[/td][/tr][tr][td]1
[/td][td][/td][td][/td][td]
[/td][td][/td][td]
[/td][td][/td][td]distinct brigade list[/td][td]Range Row[/td][/tr]
[tr][td]2
[/td][td]Division[/td][td]Brigade[/td][td]1st Division[/td][td]Mounted
[/td][td]Artillery
[/td][td]3
[/td][td]1st Guards Brigade[/td][td]1
[/td][/tr]
[tr][td]3
[/td][td]1st Division[/td][td]1st Guards Brigade[/td][td][/td][td][/td][td][/td][td][/td][td]2nd Guards Brigade[/td][td]3
[/td][/tr]
[tr][td]4
[/td][td]1st Division[/td][td]1st Guards Brigade[/td][td][/td][td][/td][td][/td][td][/td][td]3rd Guards Brigade[/td][td]5
[/td][/tr]
[tr][td]5
[/td][td]1st Division[/td][td]2nd Guards Brigade[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]6
[/td][td]1st Division[/td][td]2nd Guards Brigade[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]7
[/td][td]1st Division[/td][td]3rd Guards Brigade[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]8
[/td][td]1st Division[/td][td]3rd Guards Brigade[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]9
[/td][td]1st Division[/td][td]Mounted Troops[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]10
[/td][td]1st Division[/td][td]Mounted Troops[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]11
[/td][td]1st Division[/td][td]XXV Artillery Brigade[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]12
[/td][td]1st Division[/td][td]XXVI Artillery Brigade[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
In F2 control+shift+enter, not just enter:
=SUM(IF(FREQUENCY(IF(1-($B$3:$B$12=""),IF($A$3:$A$12=$C$2,IF(1-ISNUMBER(SEARCH(" "&$D$2&" "," "&$B$3:$B$12&" ")),IF(1-ISNUMBER(SEARCH(" "&$E$2&" "," "&$B$3:$B$12&" ")),MATCH("~"&$B$3:$B$12,$B$3:$B$12&"",0))))),ROW($B$3:$B$12)-ROW($B$3)+1),1))
In I2 control+shift+enter, not just enter, and copy down:
=IF(ROWS($I$2:I2)>$F$2,"",INDEX($B$3:$B$12,SMALL(IF(FREQUENCY(IF(1-($B$3:$B$12=""),IF($A$3:$A$12=$C$2,IF(1-ISNUMBER(SEARCH(" "&$D$2&" "," "&$B$3:$B$12&" ")),IF(1-ISNUMBER(SEARCH(" "&$E$2&" "," "&$B$3:$B$12&" ")),MATCH("~"&$B$3:$B$12,$B$3:$B$12&"",0))))),ROW($B$3:$B$12)-ROW($B$3)+1),ROW($B$3:$B$12)-ROW($B$3)+1),ROWS($I$2:I2))))
In J2 just enter and copy down:
=IF($I2="","",MATCH($I2,$B$3:$B$12,0))