Calculating average cost of specific items in a mixed list of items

SEANDON

New Member
Joined
Feb 4, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet where column G is a list of UPC codes for many products and column P is a list of costs (at various locations and at various times) for the items. I want to make a column that shows the average cost for that row's item (determined by matching the UPC column "G") by averaging out all of the costs (Pack Cost column "P") associated with that UPC.

The purpose of this is to vett the cost reported by the site (the data in each row) vs the average cost reported by all sites for the item.

I sure hope someone can understand what I wrote.

data (15).xlsx
ABCDEFGHIJKLMNOPQ
1Site NameProvinceTMtransDatedeptDescriptionsubDeptDescriptionupcItem Description (original)TY GM%GM% Low RangeGM% High RangeTY QTYTY SalesTY CostTY GM$Pack CostPack Sell
21705-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.81%4.00%12.00%5$95.9727.05$68.92$5.41$19.19
31705-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.72%4.00%12.00%7$134.0037.89$96.11$5.41$19.14
41716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.59%4.00%12.00%13$247.6370.35$177.28$5.41$19.05
51716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.54%4.00%12.00%4$76.0421.64$54.40$5.41$19.01
61716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.54%4.00%12.00%8$152.0843.28$108.80$5.41$19.01
71716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.54%4.00%12.00%4$76.0421.64$54.40$5.41$19.01
81705-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.54%4.00%12.00%16$304.2486.6$217.64$5.41$19.01
91716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.53%4.00%12.00%8$152.0843.29$108.79$5.41$19.01
101716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.53%4.00%12.00%18$342.1897.42$244.76$5.41$19.01
111705-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.52%4.00%12.00%4$76.0621.66$54.40$5.41$19.01
121705-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.52%4.00%12.00%4$76.0621.66$54.40$5.41$19.01
133881-Swan RiverManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.27%4.00%12.00%2$37.6610.82$26.84$5.41$18.83
143881-Swan RiverManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.27%4.00%12.00%2$37.6610.82$26.84$5.41$18.83
153881-Swan RiverManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN71.26%4.00%12.00%4$75.3221.65$53.67$5.41$18.83
161706-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000080IMPERIAL TOBACCO du Maurier Smooth RG 25 25UN71.10%4.00%12.00%3$56.1616.23$39.93$5.41$18.72
171706-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000080IMPERIAL TOBACCO du Maurier Smooth RG 25 25UN71.10%4.00%12.00%4$74.8821.64$53.24$5.41$18.72
181706-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000080IMPERIAL TOBACCO du Maurier Smooth RG 25 25UN71.10%4.00%12.00%2$37.4410.82$26.62$5.41$18.72
191706-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN70.86%4.00%12.00%12$222.8864.95$157.93$5.41$18.57
201706-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN70.78%4.00%12.00%18$333.4497.42$236.02$5.41$18.52
211706-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN70.78%4.00%12.00%9$166.7248.71$118.01$5.41$18.52
221706-WinnipegManitobaShaun Dunn########TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN70.74%4.00%12.00%16$296.0086.6$209.40$5.41$18.50
231716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930006059IMPERIAL TOBACCO PALL MALL TUBES 1x200 1x200UN64.80%4.00%12.00%1$6.252.2$4.05$2.20$6.25
241716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930006059IMPERIAL TOBACCO PALL MALL TUBES 1x200 1x200UN64.80%4.00%12.00%1$6.252.2$4.05$2.20$6.25
251716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930006059IMPERIAL TOBACCO PALL MALL TUBES 1x200 1x200UN64.80%4.00%12.00%1$6.252.2$4.05$2.20$6.25
261782-YorktonSaskatchewanShaun Dunn########TOBACCOITCO5930000077IMPERIAL TOBACCO John Player Rich KS 20 20UN63.90%4.00%12.00%1$13.494.87$8.62$4.87$13.49
271716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930052171IMPERIAL TOBACCO PETER JACKSON TUBES 1UN52.48%4.00%12.00%1$6.252.97$3.28$2.97$6.25
281716-WinnipegManitobaShaun Dunn########TOBACCOITCO5930052171IMPERIAL TOBACCO PETER JACKSON TUBES 1UN52.48%4.00%12.00%1$6.252.97$3.28$2.97$6.25
Export
Cell Formulas
RangeFormula
P2:P28P2=N2/L2
Q2:Q28Q2=M2/L2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:Q25Expression="P2<>(AVERAGEIF(P:P.(G2:G1000000=G2:G1000000))"textNO
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
you couyld use a pivot table
Or in a new column try
=IF(COUNTIF($G$2:G2,G2)=1,AVERAGEIF($G$2:$G$1000000,G2,$P$2:$P$1000000),"")

Book6.xlsx
ABCDEFGHIJKLMNOPQR
1Site NameProvinceTMtransDatedeptDescriptionsubDeptDescriptionupcItem Description (original)TY GM%GM% Low RangeGM% High RangeTY QTYTY SalesTY CostTY GM$Pack CostPack SellAverage
21705-WinnipegManitobaShaun Dunn44594TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7181410970.040.12595.9700012227.0499992468.920001985.40999984719.194000245.411795019
31705-WinnipegManitobaShaun Dunn44597TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7172388110.040.12713437.8899993996.110000615.41285705619.14285714 
41716-WinnipegManitobaShaun Dunn44597TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7159068080.040.1213247.630004970.34999847177.28000645.41153834419.04846191 
51716-WinnipegManitobaShaun Dunn44593TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7154129520.040.12476.0400009221.6399993954.400001535.40999984719.01000023 
61716-WinnipegManitobaShaun Dunn44594TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7154129520.040.128152.080001843.27999878108.80000315.40999984719.01000023 
71716-WinnipegManitobaShaun Dunn44598TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7154129520.040.12476.0400009221.6399993954.400001535.40999984719.01000023 
81705-WinnipegManitobaShaun Dunn44596TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7153562940.040.1216304.239990286.59999847217.63999185.41249990519.01499939 
91716-WinnipegManitobaShaun Dunn44596TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7153471830.040.128152.080001843.29000092108.79000095.41125011419.01000023 
101716-WinnipegManitobaShaun Dunn44595TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7152960420.040.1218342.179992797.41999817244.75999455.4122221219.00999959 
111705-WinnipegManitobaShaun Dunn44592TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7152248150.040.12476.0599975621.6599998554.399997715.41499996219.01499939 
121705-WinnipegManitobaShaun Dunn44595TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7152248150.040.12476.0599975621.6599998554.399997715.41499996219.01499939 
133881-Swan RiverManitobaShaun Dunn44592TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7126925190.040.12237.6599998510.8199996926.840000155.40999984718.82999992 
143881-Swan RiverManitobaShaun Dunn44594TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7126925190.040.12237.6599998510.8199996926.840000155.40999984718.82999992 
153881-Swan RiverManitobaShaun Dunn44596TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7125597490.040.12475.3199996921.6499996253.670000085.41249990518.82999992 
161706-WinnipegManitobaShaun Dunn44593TOBACCOITCO5930000080IMPERIAL TOBACCO du Maurier Smooth RG 25 25UN0.7110042810.040.12356.1599998516.2299995439.930000315.40999984718.719999955.409999847
171706-WinnipegManitobaShaun Dunn44595TOBACCOITCO5930000080IMPERIAL TOBACCO du Maurier Smooth RG 25 25UN0.7110042710.040.12474.8799972521.6399993953.239997865.40999984718.71999931 
181706-WinnipegManitobaShaun Dunn44597TOBACCOITCO5930000080IMPERIAL TOBACCO du Maurier Smooth RG 25 25UN0.7110042710.040.12237.4399986310.8199996926.619998935.40999984718.71999931 
191706-WinnipegManitobaShaun Dunn44595TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7085876010.040.1212222.880004964.94999695157.93000795.41249974618.57333374 
201706-WinnipegManitobaShaun Dunn44592TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7078335010.040.1218333.440002497.41999817236.02000435.4122221218.52444458 
211706-WinnipegManitobaShaun Dunn44597TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7078335010.040.129166.720001248.70999908118.01000215.4122221218.52444458 
221706-WinnipegManitobaShaun Dunn44598TOBACCOITCO5930000095IMPERIAL TOBACCO du Maurier Distinct Smooth KS 25 25UN0.7074324380.040.121629686.59999847209.40000155.41249990518.5 
231716-WinnipegManitobaShaun Dunn44595TOBACCOITCO5930006059IMPERIAL TOBACCO PALL MALL TUBES 1x200 1x200UN0.6479999920.040.1216.252.2000000484.0499999522.2000000486.252.200000048
241716-WinnipegManitobaShaun Dunn44596TOBACCOITCO5930006059IMPERIAL TOBACCO PALL MALL TUBES 1x200 1x200UN0.6479999920.040.1216.252.2000000484.0499999522.2000000486.25 
251716-WinnipegManitobaShaun Dunn44598TOBACCOITCO5930006059IMPERIAL TOBACCO PALL MALL TUBES 1x200 1x200UN0.6479999920.040.1216.252.2000000484.0499999522.2000000486.25 
261782-YorktonSaskatchewanShaun Dunn44595TOBACCOITCO5930000077IMPERIAL TOBACCO John Player Rich KS 20 20UN0.6389918480.040.12113.489999774.8699998868.6199998864.86999988613.489999774.869999886
271716-WinnipegManitobaShaun Dunn44594TOBACCOITCO5930052171IMPERIAL TOBACCO PETER JACKSON TUBES 1UN0.5247999950.040.1216.252.9700000293.2799999712.9700000296.252.970000029
281716-WinnipegManitobaShaun Dunn44596TOBACCOITCO5930052171IMPERIAL TOBACCO PETER JACKSON TUBES 1UN0.5247999950.040.1216.252.9700000293.2799999712.9700000296.25 
Sheet1
Cell Formulas
RangeFormula
P2:P28P2=N2/L2
Q2:Q28Q2=M2/L2
R2:R28R2=IF(COUNTIF($G$2:G2,G2)=1,AVERAGEIF($G$2:$G$2000,G2,$P$2:$P$2000),"")
 
Upvote 0
Solution

Forum statistics

Threads
1,224,117
Messages
6,176,481
Members
452,730
Latest member
palsmith

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