**Step1** | | **Step2** | **Step3** | | | | **Step4** | | | | | | | | | |

Raw data using Text-to-Columns result | | Concatenate Secondary criterias | Helper1 | Helper2 | Helper3 | | | 1 | 2 | 3 | 4 | | Final result | | | |

AA | BB | CC | DD | | =IF(AND(A3<>"",B3<>""),B3&"|"&C3&"|"&D3,"") | 1 | =IF(MOD($G3,4)=0,G3/4,INT(G3/4)+1) | =IF(H3<>H2,1,I2+1) | | =IF(K2>=MAX($H$3:$H$10),"",K2+1) | =OFFSET($A$2,MATCH($K3,$H$3:$H$10,0)+MATCH(L$2,$I$3:$I$10,0)-1,0) | =OFFSET($A$2,MATCH($K3,$H$3:$H$10,0)+MATCH(M$2,$I$3:$I$10,0)-1,0) | =OFFSET($A$2,MATCH($K3,$H$3:$H$10,0)+MATCH(N$2,$I$3:$I$10,0)-1,0) | =OFFSET($F$2,MATCH($K3,$H$3:$H$10,0),0) | =L3&" "&M3&" "&N3&" "&O3 | |

xyz | | | | | =IF(AND(A4<>"",B4<>""),B4&"|"&C4&"|"&D4,"") | =G3+1 | =IF(MOD($G4,4)=0,G4/4,INT(G4/4)+1) | =IF(H4<>H3,1,I3+1) | | =IF(K3>=MAX($H$3:$H$10),"",K3+1) | =OFFSET($A$2,MATCH($K4,$H$3:$H$10,0)+MATCH(L$2,$I$3:$I$10,0)-1,0) | =OFFSET($A$2,MATCH($K4,$H$3:$H$10,0)+MATCH(M$2,$I$3:$I$10,0)-1,0) | =OFFSET($A$2,MATCH($K4,$H$3:$H$10,0)+MATCH(N$2,$I$3:$I$10,0)-1,0) | =OFFSET($F$2,MATCH($K4,$H$3:$H$10,0),0) | =L4&" "&M4&" "&N4&" "&O4 | |

123 | | | | | =IF(AND(A5<>"",B5<>""),B5&"|"&C5&"|"&D5,"") | =G4+1 | =IF(MOD($G5,4)=0,G5/4,INT(G5/4)+1) | =IF(H5<>H4,1,I4+1) | | | | | | | | |

[end_report] | | | | | =IF(AND(A6<>"",B6<>""),B6&"|"&C6&"|"&D6,"") | =G5+1 | =IF(MOD($G6,4)=0,G6/4,INT(G6/4)+1) | =IF(H6<>H5,1,I5+1) | | | | | | | | |

AA | BB | CC | DD | | =IF(AND(A7<>"",B7<>""),B7&"|"&C7&"|"&D7,"") | =G6+1 | =IF(MOD($G7,4)=0,G7/4,INT(G7/4)+1) | =IF(H7<>H6,1,I6+1) | | | | | | | | |

xyz | | | | | =IF(AND(A8<>"",B8<>""),B8&"|"&C8&"|"&D8,"") | =G7+1 | =IF(MOD($G8,4)=0,G8/4,INT(G8/4)+1) | =IF(H8<>H7,1,I7+1) | | | | | | | | |

123 | | | | | =IF(AND(A9<>"",B9<>""),B9&"|"&C9&"|"&D9,"") | =G8+1 | =IF(MOD($G9,4)=0,G9/4,INT(G9/4)+1) | =IF(H9<>H8,1,I8+1) | | | | | | | | |

[end_report] | | | | | =IF(AND(A10<>"",B10<>""),B10&"|"&C10&"|"&D10,"") | =G9+1 | =IF(MOD($G10,4)=0,G10/4,INT(G10/4)+1) | =IF(H10<>H9,1,I9+1) | | | | | | | | |