Hi,
Provided the client names are unique, then I believe that you can achieve this with formulas.
This answer assumes that the data starts in cell A2 with the numbers in column B, and that there are no gaps.
In sheet 2 in column C row 2 you need to enter =IF(A2="",C1,A2)
In sheet 2 in column D row 2 you need to enter =B2
Then in sheet 1 I had the following set up:
In cells C1 to K1 enter values 1 to 9 sequentially.
Cell A2 is where you enter the query you want an answer for
In Cell B2 enter =COUNTIF(Sheet2!$C$2:$C$12,A2)-1
In Cell C2 enter =INDIRECT("Sheet2!D"&MATCH($A2,Sheet2!$C$2:$C$12,0)+C$1)
Drag cell C2 across to cell K2.
This answer assumes that there are no more that 9 codes per member - if there are more then expand teh number range in row 1 to match the anticipated number, and drag cell K2 across to the last column with a value in it.
There might be a more elegant way to do it, but I have used this before without any problems.