In you example data in Output, imho, does not matching with BOM data.

B
C
D
1
Parent desc Mat type Component
6
Item 1 C
3.1
7
Item 1 C
3.2
Sheet: Output

B
C
D
1
Parent Desc Component Comp Desc
10
Comp 4
3.1
Comp 9
11
Comp 4
3.2
Comp 10
Sheet: BOM