Slight errata ..
In x,
Amend the formula in AH3 to this:
=IF(OFFSET($A$3:$A$9,,MATCH(y!$A$2,$A$1:$AF$1,0)-1)="","",
IF(OFFSET($A$3:$A$9,,MATCH(y!$A$2,$A$1:$AF$1,0)-1)=AH$2,ROWS($1:1),""))
Then copy AH3 across/fill down to AK9
(the earlier "$Z$1" should be extended to "$AF$1")
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---