On one worksheet is a list of three columns - Item #, Item Description, and Quantity needed. Item # contains the name of the product AND the materials used to make the product. I need to convert this long list into a column based form, where each Product is a row and separate the materials needed into columns.

For Example

ItemID Item Description Qty Needed
C0001 EZCoat PC10
P0041 Potassium Sulfate 0.6250
P0021 Borax 5 mole 0.2000
P0008 Ethoxylated Nonylphenol (9 mo) 0.0050
P0038 Sodium Sulfate 0.0500
P0042 Sodium Gluconate 0.0500
P0025 Trisodium Phosphate Crystals 0.0500

Where the items listed with a "C" are the codes for the main product and "P" are the materials need to make "C"

The spreadsheet I'm trying to create looks like this


Product Code Product Name Potassium Sulfate Borax Ethoxlated Sodium
C0001 EZCoat PC10 0.625 .2000 .0050 .05


Because I have hundreds of chemicals, I can't do a simple row to column change. I need a way for it to match the product code and put the amount of chemical needed into the correct column.

I thought this would be simple, but I'm really stuck. Help