Return a summing and averaging filtered gain or losses values.

mmr1

Board Regular
Joined
Aug 25, 2020
Messages
58
Office Version
  1. 365
Platform
  1. Windows
Hi,

As in a sample sheet enclosed herein the data contains three columns and headers like weeks, location and Gain or Loss, I already worked out for Sum and Average (Column C27:C30) of values gain and loss (unfiltered category)

I am looking a formula for Sum and Average (Column C32:C35) of values gain and loss (filtered category) where Sum and Average gain and loss values to be returns as per filtered headers of column A or B, for example If I apply filter to Area1 criteria of Column B then sum and Average values to be return as per filtered criteria.

Thanks for the help.

Summing and averaging filtered and unfiltered list separately for gain and losess.xlsx
ABC
1
2WeeksLocationGain or Loss
3Week1Area 1(4,540.00)
4Week1Area 21,565.00
5Week1Area 3(1,937.00)
6Week2Area 11,986.00
7Week2Area 2(1,880.00)
8Week2Area 31,763.00
9Week3Area 11,808.00
10Week3Area 21,468.00
11Week3Area 3(2,286.00)
12Week4Area 1(2,635.00)
13Week4Area 22,451.00
14Week4Area 31,829.00
15Week5Area 1(1,257.00)
16Week5Area 29,332.00
17Week5Area 311,070.00
18Week6Area 11,647.00
19Week6Area 2(2,230.00)
20Week6Area 31,180.00
21Week7Area 1(2,259.00)
22Week7Area 2(12,036.00)
23Week7Area 36,565.00
24
25
26
27Total Sum of Gain (Unfiltred)42,664.00
28Total Sum of Loss (Unfiltered)(26,520.00)
29Total Average of Gain (Unfiltered)3,555.33
30Total Average of Loss (Unfiltered)(3,451.11)
31
32Total Sum of Gain (filtred)
33Total Sum of Loss (filtered)
34Total Average of Gain (filtered)
35Total Average of Loss (filtered)
Sheet1
Cell Formulas
RangeFormula
C27C27=SUMIF($C$3:$C$23,">0")
C28C28=SUMIF($C$4:$C$24,"<0")
C29C29=AVERAGEIF($C$3:$C$23,">0")
C30C30=AVERAGEIF($C$3:$C$23,"<0")
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

mmr1

Board Regular
Joined
Aug 25, 2020
Messages
58
Office Version
  1. 365
Platform
  1. Windows
Hi,

Could someone look into this query i actually seeking a formula for subtotals sum and average for positive and negative values.

Thanks,appreciate your help.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,805
Office Version
  1. 365
Platform
  1. Windows
How about
+Fluff v2.xlsm
ABC
1
2WeeksLocationGain or Loss
3Week1Area 1(4,540.00)
4Week1Area 21,565.00
5Week1Area 3(1,937.00)
6Week2Area 11,986.00
7Week2Area 2(1,880.00)
8Week2Area 31,763.00
9Week3Area 11,808.00
10Week3Area 21,468.00
11Week3Area 3(2,286.00)
12Week4Area 1(2,635.00)
13Week4Area 22,451.00
14Week4Area 31,829.00
15Week5Area 1(1,257.00)
16Week5Area 29,332.00
17Week5Area 311,070.00
18Week6Area 11,647.00
19Week6Area 2(2,230.00)
20Week6Area 31,180.00
21Week7Area 1(2,259.00)
22Week7Area 2(12,036.00)
23Week7Area 36,565.00
24
25
26
27Total Sum of Gain (Unfiltred)42,664.00
28Total Sum of Loss (Unfiltered)(31,060.00)
29Total Average of Gain (Unfiltered)3,555.33
30Total Average of Loss (Unfiltered)(3,451.11)
31
32Total Sum of Gain (filtred)42,664.00
33Total Sum of Loss (filtered)(31,060.00)
34Total Average of Gain (filtered)3,555.33
35Total Average of Loss (filtered)(3,451.11)
Clubs
Cell Formulas
RangeFormula
C27C27=SUMIF($C$3:$C$23,">0")
C28C28=SUMIF($C$3:$C$23,"<0")
C29C29=AVERAGEIF($C$3:$C$23,">0")
C30C30=AVERAGEIF($C$3:$C$23,"<0")
C32C32=SUMPRODUCT(SUBTOTAL(9,OFFSET($C$3,ROW($C$3:$C$23)-ROW($C$3),0,1)),--($C$3:$C$23>0))
C33C33=SUMPRODUCT(SUBTOTAL(9,OFFSET($C$3,ROW($C$3:$C$23)-ROW($C$3),0,1)),--($C$3:$C$23<0))
C34C34=AVERAGE(IF(C3:C23>0,IF(SUBTOTAL(2,OFFSET(C3,ROW(C3:C23)-ROW(C3),0)),C3:C23)))
C35C35=AVERAGE(IF(C3:C23<0,IF(SUBTOTAL(2,OFFSET(C3,ROW(C3:C23)-ROW(C3),0)),C3:C23)))


WeeksLocationGain or Loss
Week1Area 1(4,540.00)
Week2Area 11,986.00
Week3Area 11,808.00
Week4Area 1(2,635.00)
Week5Area 1(1,257.00)
Week6Area 11,647.00
Week7Area 1(2,259.00)
Total Sum of Gain (Unfiltred)42,664.00
Total Sum of Loss (Unfiltered)(31,060.00)
Total Average of Gain (Unfiltered)3,555.33
Total Average of Loss (Unfiltered)(3,451.11)
Total Sum of Gain (filtred)5,441.00
Total Sum of Loss (filtered)(10,691.00)
Total Average of Gain (filtered)1,813.67
Total Average of Loss (filtered)(2,672.75)
 

mmr1

Board Regular
Joined
Aug 25, 2020
Messages
58
Office Version
  1. 365
Platform
  1. Windows
Thank you so much fluff for being supportive always and provided nice solution to the query.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,805
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,128,165
Messages
5,629,068
Members
416,363
Latest member
zaveedd

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
Top