First, select AZ7 and define the following...
Range:
=INDEX(Data,0,ROWS('Update Appraisal'!$AZ$7:$AZ7))
Txt:
=LEFT('Update Appraisal'!$AX7,LEN('Update Appraisal'!$AX7))
Array1:
=IF('Update Appraisal'!$BB7>0,TRANSPOSE(ROW(INDIRECT("1:"&'Update
Appraisal'!$BB7))),1)
Array2:
=ISNUMBER(MATCH(IF(Range=Txt,ROW(Range)+IF('Update
Appraisal'!$BB7>0,Array1,1),""),IF(Range=IF('Update
Appraisal'!$BB7>0,"",Txt),ROW(Range)),0))+0
Array3:
=MMULT(Array2,IF('Update Appraisal'!$BB7>0,ROW(INDIRECT("1:"&'Update
Appraisal'!$BB7))^0,1))
Array4:
=ISNA(MATCH(IF(Range=Txt,ROW(Range)+'Update
Appraisal'!$BB7+1,""),IF(Range="",ROW(Range),""),0))
Then try the following formula, which needs to be confirmed with
CONTROL+SHIFT+ENTER...
AZ7, copied down:
=INDEX(ID,LARGE(IF(Array3=IF($BB7>0,$BB7,1),IF(IF($BB7>0,Array4,1),ROW(ID
)-MIN(ROW(ID))+1)),2)+IF($BB7>0,$BB7,1))
Hope this helps!