
Originally Posted by
Pete_UK
I've taken a different approach to Glenn, which does not involve changing your source sheet.
In the Current Table sheet I've used column C as a helper, with this formula in C1:
=IF(A1="Agent Name:",COUNTIF(A$1:A1,A1),"-")
You can copy this down as far as you need to, even beyond your data - the hyphens help to show where the formula is active. This formula just identifies the start of each record by means of a sequential number.
I've also use a helper column in the Ideal Table sheet, with this formula in P2:
=IFERROR(MATCH(ROWS($1:1),'Current Table'!$C:$C,0),"")
This is mainly to shorten the other formulae, and it works out the row in the first sheet where each record begins. I've used the following formula in cell A2:
=IF($P2="","",INDEX('Current Table'!$B:$B,$P2))
which brings the agent name across, and this one in B2:
=IF($A2="","",IFERROR(INDEX('Current Table'!$B:$B,MATCH(B$1,INDEX('Current Table'!$A:$A,$P2):INDEX('Current Table'!$A:$A,$P2+13),0)+$P2-1)&"",""))
and this one can be copied across to N2 to bring the other fields across. It is important that the field names in row 1 exactly match those used in the first sheet, so you need to correct the spelling of Certification in cell J1.
Finally, the formulae in A2:P2 can be copied down as far as you need to, until you start to get blanks. You could put this formula in cell Q2 for example:
=COUNTIF('Current Table'!A:A,A1)
to tell you how many records to expect.
Hope this helps.
Pete
Bookmarks