Help using conditional sumproduct for weighted average to get avg COGS

jscaggs

New Member
Joined
Oct 23, 2009
Messages
2
Hello and thank you in advance for any help you can provide with my scenario below:

I have a multi sheet workbook with the following breakdown:

Receiving - Here we receive products and enter model, qty, and cost. Each day we add additional items to this sheet and want them added to current inventory.

Shipping - Here we log model shipped, qty shipped and sale price. Each day we add additional items to this sheet and want them deducted from the inventory left in stock.

Current Inventory - Here we have our master list of products and need our AVG COGS as well as qty available.


To calculate average COGS I am using a formula such as the following:

=(IF(J2:J5000="Blackberry 8700c Needs Repair",SUMPRODUCT(K2:K5000,L2:L5000/SUM(K2:K5000))))


The issue here is that I want my AVG COGS to look at the entire receiving sheet and if the model name matches the model name on the Current Inventory line item then I want it to check the qty received and the cost to accurately adjust my AVG COGS.

Now it is doing the weighted average part right for my COGS but it is not excluding the values where the model name doesn't match up.

Please any help appreciated!!!

Thanks,
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Are you after?...
Code:
=SUMPRODUCT(--(J2:J5000="Blackberry 8700c Needs Repair"),K2:K5000,L2:L5000)/
    SUMIF(J2:J5000,"Blackberry 8700c Needs Repair",K2:K5000)
 
Upvote 0
Yes I just tested the formula you gave me and it seems to be working perfectly!!!
:)


Will this formula work if I have it looking at a range that is located in a different worksheet? Basically I'm asking if it could look something like this:

='Receiving Log'!J3:J5000 instead of just J:3:J5000


I will continue building and post any troubles I am having.

This board is great.

Again thank you very much!!
 
Upvote 0
Yes I just tested the formula you gave me and it seems to be working perfectly!!!
:)

You are welcome.

Will this formula work if I have it looking at a range that is located in a different worksheet? Basically I'm asking if it could look something like this:

='Receiving Log'!J3:J5000 instead of just J:3:J5000

I will continue building and post any troubles I am having.

This board is great.

Again thank you very much!!

Yes, it should work with sheet refs ...
 
Upvote 0

Forum statistics

Threads
1,215,619
Messages
6,125,873
Members
449,267
Latest member
ajaykosuri

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