Formula help needed

slouis

New Member
Joined
Dec 2, 2016
Messages
11
Column G has entries below in its row(s):
3<o:p></o:p>

0<o:p></o:p>
0<o:p></o:p>
6<o:p></o:p>
9<o:p></o:p>
0<o:p></o:p>
8<o:p></o:p>
6<o:p></o:p>
<o:p> </o:p>
Thereare 8 entries. Lowest value is 0. Highest value is 9. Takeout all the lowest entries with “0” (B,C,F) and all the highest values (in this case it's 9 but there's only one of them). Highest here is “9” (E) and that leaves3, 6, 8, & 6. So 4 entries left, totaling 23. Avg = 5.75.

I'm looking for a formula that can handle this sequence. # of entries will vary. # of duplicate MIN & MAX will vary. Entries will be dependent on some manual filtering... so row designations will always be different but Column will always be "G"
 
Excuse my late involvement but if you have Excel 2010 or later then I think the AGGREGATE function is the way to go with this.
Still as far as I see it requiring a 'Helper' column, which you may hide.

Excel 2012
ABCDEFG
1HelperLocationDutyCOST
23AwayWork3
4#DIV/0!AwayWork0
5#DIV/0!Awaysleep0
6#DIV/0!AwayWork9
96AwayWork6
10#DIV/0!AwayWork9
138AwayWork8
156AwayWork6
31Result5.75
Sheet1
Cell Formulas
RangeFormula
A2=IF(OR(G2=AGGREGATE(5,7,G$2:G$30),G2=AGGREGATE(4,7,G$2:G$30)),G2/0,G2)
D31=AGGREGATE(1,7,A2:A30)


Hope that helps.
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Or to facilitate the understanding and maintenance of the formula


A
B
C
D
E
1
Location​
Duty​
COST​
3
Away​
sleep​
2​
5
Away​
sleep​
9​
7
Away​
sleep​
8​
8
Away​
sleep​
7​
12
Away​
sleep​
5​
14
Away​
sleep​
2​
18
19
20
Max​
Min​
SUM​
Count​
Result​
21
9​
2​
20​
3​
6,666667​
[/tr]

[/tr]

[/tr]

[/tr]
[/tr]
[/tr]

[/tr]

[/tr]
[/tr]
[/tr]


Formula in A21
=SUBTOTAL(4,C2:C17)

Formula in B21
=SUBTOTAL(5,C2:C17)

Formula in C21
=SUMPRODUCT(--SUBTOTAL(3,OFFSET(A2:A17,ROW(A2:A17)-ROW(A2),0,1)),--(C2:C17>B21),--(A21>C2:C17),C2:C17)

Formula in D21
SUMPRODUCT(--SUBTOTAL(3,OFFSET(A2:A17,ROW(A2:A17)-ROW(A2),0,1)),--(C2:C17>B21),--(A21>C2:C17))

Formula in E21 (Result)
=C21/D21

M.
 
Upvote 0
Different criteria


A
B
C
1
Location​
Duty​
COST​
2
Away​
Work​
3​
4
Away​
Work​
0​
6
Away​
Work​
0​
9
Away​
Work​
6​
10
Away​
Work​
9​
11
Away​
Work​
0​
13
Away​
Work​
8​
15
Away​
Work​
6​
18
19
20
Formula​
21
5,75​
[/tr]

[/tr]

[/tr]
[/tr]

[/tr]

[/tr]

[/tr]
[/tr]


M.
 
Upvote 0
Hi ,

=(SUBTOTAL(109,G2:G17)-(SUBTOTAL(104,G2:G17)*(SUMPRODUCT(SUBTOTAL(3,OFFSET(G2:G17,ROW(G2:G17)-MIN(ROW(G2:G17)),,1)),ISNUMBER(SEARCH(MAX(G2:G17),G2:G17))+0))))/((SUBTOTAL(103,G2:G17))-(SUMPRODUCT(SUBTOTAL(3,OFFSET(G2:G17,ROW(G2:G17)-MIN(ROW(G2:G17)),,1)),ISNUMBER(SEARCH(0,G2:G17))+0))-(SUMPRODUCT(SUBTOTAL(3,OFFSET(G2:G17,ROW(G2:G17)-MIN(ROW(G2:G17)),,1)),ISNUMBER(SEARCH(MAX(G2:G17),G2:G17))+0)))
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

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