Formula for subtotal with conditions, in Pivot with Calculation - Fields (Pivot - Analyze - Calculation - Fields - subtotal by condition IF or SUMIF)

newton_iss

New Member
Joined
May 29, 2018
Messages
2
This is Pivot table. Field1 is counted as Bottle price / Volume. But Subtotal for Field 1 is wrong.

21,2654321 is wrong answer, watching data, we understand that price of Bottle per Lt is 65.
For some reason, Field 1 is taking all volume.

Perfect Formula would look like this: IFERROR('Bottle Price'/SUMIF(Pack;"Bottle";Volume);0), but it doesent work in calculated fields formela.


[TABLE="width: 733"]
<colgroup><col><col><col><col><col><col><col span="2"></colgroup><tbody>[TR]
[TD]Brand[/TD]
[TD]Pack[/TD]
[TD]SKU[/TD]
[TD]Sum of Volume lt[/TD]
[TD]Sum of Bottle Price[/TD]
[TD]Sum of CAN price[/TD]
[TD]Sum of Field1[/TD]
[TD]Sum of Field2[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]Bottle[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]65000[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]Bottle[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1060[/TD]
[TD="align: right"]68900[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]Bottle[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1120[/TD]
[TD="align: right"]72800[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD="colspan: 2"]Bottle Total[/TD]
[TD="align: right"]3180[/TD]
[TD="align: right"]206700[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]Keg[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]1020[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]Keg[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1080[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]Keg[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1140[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD="colspan: 2"]Keg Total[/TD]
[TD="align: right"]3240[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]CAN[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]1040[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]91520[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]CAN[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1100[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]96800[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD]CAN[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1160[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]102080[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD]Bud[/TD]
[TD="colspan: 2"]CAN Total[/TD]
[TD="align: right"]3300[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]290400[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD]Bud Total[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]9720[/TD]
[TD="align: right"]206700[/TD]
[TD="align: right"]290400[/TD]
[TD="align: right"]21,2654321[/TD]
[TD="align: right"]29,87654321[/TD]
[/TR]
[TR]
[TD]Corona Extra[/TD]
[TD]Bottle[/TD]
[TD]Dark[/TD]
[TD="align: right"]1180[/TD]
[TD="align: right"]76700[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Corona Extra[/TD]
[TD]Bottle[/TD]
[TD]Light[/TD]
[TD="align: right"]1220[/TD]
[TD="align: right"]79300[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Corona Extra[/TD]
[TD="colspan: 2"]Bottle Total[/TD]
[TD="align: right"]2400[/TD]
[TD="align: right"]156000[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Corona Extra[/TD]
[TD]CAN[/TD]
[TD]Dark[/TD]
[TD="align: right"]1200[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]105600[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD]Corona Extra[/TD]
[TD]CAN[/TD]
[TD]Light[/TD]
[TD="align: right"]1240[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]109120[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD]Corona Extra[/TD]
[TD="colspan: 2"]CAN Total[/TD]
[TD="align: right"]2440[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]214720[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD="colspan: 2"]Corona Extra Total[/TD]
[TD][/TD]
[TD="align: right"]4840[/TD]
[TD="align: right"]156000[/TD]
[TD="align: right"]214720[/TD]
[TD="align: right"]32,23140496[/TD]
[TD="align: right"]44,36363636[/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]14560[/TD]
[TD="align: right"]362700[/TD]
[TD="align: right"]505120[/TD]
[TD="align: right"]24,91071429[/TD]
[TD="align: right"]34,69230769[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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