ThanksHi,
Your raw data is inconsistent, I think formula solution will be very difficult; but, if pivots are allowed, your report will looks something like this, (with some helper columns)
View attachment 27284
See if it helps.
Regards,
Glad it solvedThanks
it solves the query
How those employee code (a) & employee code (b) derived ?

Try this formula solution way.
1] Data require format Sheet, E6 enter array formula (Confirm entered with SHIFT+CTRL+ENTER instead of just ENTER)
=INDIRECT("'raw data'!"&TEXT(SMALL(IF((ISTEXT('raw data'!$B$4:$F$50))*('raw data'!$B$4:$F$50<>"Male"),ROW($4:$50)/1%+{2,3,4,5,6},9099),ROW(A1)),"R0C00"),)&""
2] Data require format Sheet, D6 enter formula
=IFERROR(INDEX('raw data'!A$4:A$50,MATCH(E6,'raw data'!B$4:B$50,0)),"")
All copy down
Regards
Bosco
Thanks Bosco,
But unable to change the same while entering more data
Please find attached data
Thanks
Nitin