You could put a formula like this in the first sheet (in E2, assuming you have a header row):
Formula:
=IF(AND(A2=1,B2="OS"),MAX($E$1:$E1)+1,"")
When you copy this down you will get a simple sequence against records which match the criteria and blanks otherwise.
In the second sheet you can have this formula in A2:
Formula:
=IFERROR(MATCH(ROWS($2:2),Sheet1!E:E,0),"-")
which will find the rows that have been marked in the first sheet, then this formula in B2:
Formula:
=IF(OR($A2="",$A2="-"),"",INDEX(Sheet1!A:A,$A2))
This formula can be copied across to E2, then the formulae in A2:E2 can be copied down as far as you need them (until you see a hyphen in column A).
To set up different criteria, you just need to change the formula in Sheet1.
Hope this helps.
Pete
Bookmarks