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"
 
Try this

=SUMIFS(J1:J8,J1:J8,">"&MIN(J1:J8),J1:J8,"<"&MAX(J1:J8))/COUNTIFS(J1:J8,">"&MIN(J1:J8),J1:J8,"<"&MAX(J1:J8))
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
@Anand Sharma:

I am just curious -- how does your formula handle data filtering (mentioned in Posts #1, 3, 5, and 9)?
 
Upvote 0
nope, this one is not working either. Here are the test results below. The answer should be 6.67. The 9 and both 2s should be removed, leaving only 5,7,8. This totals 20. There are three digits left. The division = 6.67

LocationDutyCOST
Awaysleep2
Awaysleep9
Awaysleep8
Awaysleep7
Awaysleep5
Awaysleep2
RESULT = 5.50

<colgroup><col width="64" style="width: 48pt;"> <col width="67" style="width: 50pt; mso-width-source: userset; mso-width-alt: 2450;"> <col width="64" style="width: 48pt;" span="3"> <tbody>
</tbody>
 
Upvote 0
Sorry, here is the result. It still doesn't work but I wanted to show the correct calc (I had forgotten to insert as array)

LocationDutyCOST
Awaysleep2
Awaysleep9
Awaysleep8
Awaysleep7
Awaysleep5
Awaysleep2
RESULT = 9.00

<colgroup><col width="64" style="width: 48pt;"> <col width="67" style="width: 50pt; mso-width-source: userset; mso-width-alt: 2450;"> <col width="64" style="width: 48pt;" span="3"> <tbody>
</tbody>
 
Upvote 0
nope, this one is not working either. Here are the test results below. The answer should be 6.67. The 9 and both 2s should be removed, leaving only 5,7,8. This totals 20. There are three digits left. The division = 6.67

LocationDutyCOST
Awaysleep2
Awaysleep9
Awaysleep8
Awaysleep7
Awaysleep5
Awaysleep2
RESULT = 5.50

<tbody>
</tbody>


Maybe this...


A
B
C
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
Formula​
21
6,666666667​

<tbody>
</tbody>


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

Hope this helps

M.
 
Upvote 0
yes I am willing
OK. I set column Z as the service column, but you can move it anywhere you like.

Put the following formula in cell Z2 and copy it down to beyond the last row of your data:

=--(AGGREGATE(3,5,$G2)>0)

For the final result, try the following formula (it is a regular formula, NOT an array one):

Code:
=(SUBTOTAL(109,$G$2:$G$20000)-SUMPRODUCT(($G$2:$G$20000=SUBTOTAL(104,$G$2:$G$20000))*($Z$2:$Z$20000))*SUBTOTAL(104,$G$2:$G$20000)-SUMPRODUCT(($G$2:$G$20000=SUBTOTAL(105,$G$2:$G$20000))*($Z$2:$Z$20000))*SUBTOTAL(105,$G$2:$G$20000))/(SUBTOTAL(102,$G$2:$G$20000)-SUMPRODUCT(($G$2:$G$20000=SUBTOTAL(104,$G$2:$G$20000))*($Z$2:$Z$20000))-SUMPRODUCT(($G$2:$G$20000=SUBTOTAL(105,$G$2:$G$20000))*($Z$2:$Z$20000)))
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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