SOLVED

The average of the product of two columns across several worksheets

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3150990%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3EThe%20average%20of%20the%20product%20of%20two%20columns%20across%20several%20worksheets%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3150990%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EHello%2C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI%20am%20struggling%20with%20writing%20a%20formula%20to%20take%20the%20average%20of%20the%20product%20of%20two%20columns%20across%2015%2B%20identical%20worksheets.%20The%20two%20columns%20have%20numerical%20data%2C%20and%20the%20constraint%20is%20that%20I%20can't%20add%20another%20column%20on%20the%20worksheets%20to%20take%20the%20product%20before%20averaging%20it.%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%5C%26quot%3Blia-inline-image-display-wrapper%22%20lia-image-align-inline%3D%22%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fgxcuf89792%2F%5C%26quot%3Bhttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F347101i43C4AC0992059B98%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%5C%26quot%3B%22%20role%3D%22%5C%26quot%3Bbutton%5C%26quot%3B%22%20title%3D%22Shawna760_0-1644517991178.png%22%20alt%3D%22%5C%26quot%3BShawna760_0-1644517991178.png%5C%26quot%3B%22%20%2F%3E%26lt%3B%5C%2Fspan%26gt%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%5C%26quot%3Blia-inline-image-display-wrapper%22%20lia-image-align-inline%3D%22%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fgxcuf89792%2F%5C%26quot%3Bhttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F347103iDB0596B9ABFC376B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%5C%26quot%3B%22%20role%3D%22%5C%26quot%3Bbutton%5C%26quot%3B%22%20title%3D%22Average%20Example.png%22%20example.png%3D%22%22%20alt%3D%22Average%20Example.png%22%20%2F%3E%26lt%3B%5C%2Fspan%26gt%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EPlease%20see%20example%20Excel%20Sheets%20attached.%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EThanks%2C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EShawna%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3CLINGO-LABS%20id%3D%22%5C%26quot%3Blingo-labs-3150990%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CLINGO-LABEL%3EExcel%26lt%3B%5C%2Flingo-label%26gt%3B%26lt%3B%5C%2Flingo-labs%26gt%3B%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3150990%22%20slang%3D%22en-US%22%3EThe%20average%20of%20the%20product%20of%20two%20columns%20across%20several%20worksheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3150990%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20struggling%20with%20writing%20a%20formula%20to%20take%20the%20average%20of%20the%20product%20of%20two%20columns%20across%2015%2B%20identical%20worksheets.%20The%20two%20columns%20have%20numerical%20data%2C%20and%20the%20constraint%20is%20that%20I%20can't%20add%20another%20column%20on%20the%20worksheets%20to%20take%20the%20product%20before%20averaging%20it.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Shawna760_0-1644517991178.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F347101i43C4AC0992059B98%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Shawna760_0-1644517991178.png%22%20alt%3D%22Shawna760_0-1644517991178.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Average%20Example.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F347103iDB0596B9ABFC376B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Average%20Example.png%22%20alt%3D%22Average%20Example.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20see%20example%20Excel%20Sheets%20attached.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EShawna%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3150990%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hello,

 

I am struggling with writing a formula to take the average of the product of two columns across 15+ identical worksheets. The two columns have numerical data, and the constraint is that I can't add another column on the worksheets to take the product before averaging it. 

 

Shawna760_0-1644517991178.png

Average Example.png

 

Please see example Excel Sheets attached. 

 

Thanks,

 

Shawna 

8 Replies

@Shawna760 

Why not append the tables from several worksheets with Power Query? After this it's simple to calculate the sumproduct and the average. Writing VBA code for this would be much more difficult and setting up a formula with the INDIRECT function for 15+ worksheets to achieve this result, i wonder if this is even possible.

@Quadruple_Pawn thank for the feedback, it may be more complicated than that... I need to take the product of the severity and probability for a specific row (hazard type) across all of the worksheets and then average that to get the average risk rating for that hazard. I tried the sumproduct function but I couldn't get it to work for this purpose. Would appending the tables make it possible? If it is not possible, I can work on an alternative solution, just wanted to exhaust all options before coming up with a more complicated work-around.

@Shawna760 

Does the example in sheet "Tabelle1" in the attached file show what you want to do? If so i would append all tables with Power Query and then apply the formulas in one resulting worksheet.

@Quadruple_Pawn 

It didn't quite match the idea, I edited it to give you a better picture of the problem.

@Shawna760 

I removed the merged cells A2 and B2 in all tables in order to convert the tables Assembly 1 - 3 and Machining 1 - 3 into dynamic tables and to append them with Power Query.

 

In the summary table the AVERAGEIF and AVERAGEIFS formulas calculate the results you might be looking for.

@Quadruple_Pawn 

That is very close to accomplishing the goal, but I was trying to avoid adding the extra column in the sheets if at all possible. If I have to add an extra column and hide it, then I would probably just make that the product column and use an AVG function (i.e. =AVERAGE('Assembly 1:Machining 3'!E3)) where E3 is the product column. I have 54 sheets total, so it may be a bit cumbersome, but if there is no alternative I will have to use it.

best response confirmed by Shawna760 (Occasional Contributor)
Solution

@Shawna760 

In my understanding you have solved the task yourself. Your solution is much easier than Power Query and if i may i would suggest to enter an additional column in all of your 54 sheets.

 

All your sheets have the same layout which means that you can easily add the additional column. 

You can select all the 54 Assembly and Machining sheets by activating the first (Assembly) sheet and then holding down the ctrl key and select the remaining sheets with mouseclicks.

Then enter formula 

=C3*D3

in the first sheet and copy the formula down.

Then hold the ctrl key down again and deselect the other sheets with mouseclicks.

Now in all sheets the formulas are entered and the product column is added.

That works great! I thought I would have to do it for each individual sheet, but I just tried it and I can make all of the edits on a single sheet and it copies over to the others. Thanks!