This may be an overly ambitious (read complicated) approach. In M4:T4 non-array entered. Double click the fill handle. (Make sure calculation is set to Automatic.) It takes about 4-5 seconds to calculate.
I have not done a painstaking check of the returns. What I have checked works so far.
Formula:
=IFERROR(INDEX(INDEX($I$4:$L$1081,MATCH(1,INDEX(1/($E4=$E$4:$E$1081),0),-1),1):INDEX($I$4:$JL1081,MATCH(2,INDEX(1/($E4=$E$4:$E$1081),0),1),4),
MATCH(TRIM(LEFT(SUBSTITUTE(M$3," ",REPT(" ",99)),99)),INDEX($H$4:$H$1081,MATCH(1,INDEX(1/($E4=$E$4:$E$1081),0),-1),):
INDEX($H$4:$H$1081,MATCH(2,INDEX(1/($E4=$E$4:$E$1081),0),1),),0),COUNTIF($M$3:M$3,LEFT(M$3,5)&"*")),"")
PS I forgot to mention ... if you are willing to have 2-4 helper columns this formula can be made much smaller. It will likely speed up calculations as well. Just let me know.
Bookmarks