Power Pivot to get sequence of ingredients

BDlani

New Member
Joined
Oct 11, 2017
Messages
1
Have a need to get a list of ingredients we will need based on a sequence list(schedule we will run) and an ingredient list. Here is simple list of data to show the tables I have and the output table based on these tables. I know it could be done with a macro but would prefer to have done with pivot table with calculated field. Have looked at several blogs on this a thought I was close but can not get to work.

sequenceLine CodeOrdered QTY (ton)
1420000147
2420000222
3420000150
4420000335

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Ingredient table
Line Code ingredient Qty per ton
4200001 MILLET 1020.0
4200001 WHEAT 980.0
4200002 MILLET 600.0
4200002 WHEAT 500.0
4200002 STARCH 400.0
4200002 DEXTROSE 300.0
4200002 GELATIN 200.0
4200003 STARCH 1500.0
4200003 WHEAT 250.0
4200003 CARROT 250.0

This is what i want the output to be.
sequenceLine CodeOrdered QTYMILLETWHEATSTARCHDEXTROSEGELATIN CARROT
14200001474794046060
24200002221320011000880066004400
34200001505100049000
4420000335 875052500 8750

<colgroup><col><col><col><col span="3"><col><col span="2"></colgroup><tbody>
</tbody>

<colgroup><col><col><col><col span="3"><col><col span="2"></colgroup><tbody>
</tbody>


<colgroup><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Welcome to the board.

I'm not quite sure how to get that from a Pivot Table. I'll experiment when I get a chance. In the meantime, here's a way to do it with formulas. Assuming your ingredient table is on Sheet1, columns A:C, then these formulas should work:

ABCDEFGHIJ
1sequenceLine CodeOrdered QTY (ton)MILLETWHEATSTARCHDEXTROSEGELATINCARROT
214200001474794046060
324200002221320011000880066004400
434200001505100049000
544200003358750525008750
6

<tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
E2=IFERROR($C2/(1/SUMIFS(Sheet1!$C:$C,Sheet1!$A:$A,$B2,Sheet1!$B:$B,E$1)),"")

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
E1{=IFERROR(INDEX(Sheet1!$B:$B,SMALL(IF(Sheet1!$B$3:$B$20<>"",IF(MATCH(Sheet1!$B$3:$B$20,Sheet1!$B$3:$B$20,0)=ROW(Sheet1!$B$3:$B$20)-ROW(Sheet1!$B$3)+1,ROW(Sheet1!$B$3:$B$20))),COLUMNS($E$1:E$1))),"")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



These go on Sheet2. Columns A:C are your input data. Put the E1 formula in, change the references to match your sheet, then press Control+Shift+Enter. Then drag right as far as needed. Note that this is just to create a unique list of ingredients. If you have such a list, you can manually enter it and save some processing.

Now put the E2 formula in, and drag down and to the right as far as needed.

Hope this helps.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,409
Messages
6,119,339
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top