Dynamically Changing QUARTILE Array When Value Changes

bdbrew

New Member
Joined
May 13, 2016
Messages
11
Using MS Office Professional Plus 2013

I have a table with data grouped by item #. I would like to use the formula below on each group with the ability to copy the formula down, and have the QUARTILE function reference each group separately.

=IF(OR(C2>(QUARTILE(C$2:C$13,3)+(1.5*(QUARTILE(C$2:C$13,3)-QUARTILE(C$2:C$13,1)))),C2<(QUARTILE(C$2:C$13,1)-(1.5*(QUARTILE(C$2:C$13,3)-QUARTILE(C$2:C$13,1))))),"Outlier","")

The formula above would be for the first group of items. There is a blank row between each group. The next group should have the same formula, but the QUARTILE array would change:

=IF(OR(C2>(QUARTILE(C$15:C$20,3)+(1.5*(QUARTILE(C$2:C$13,3)-QUARTILE(C$2:C$13,1)))) . . .

I assume some form of dynamic named range would be used in place of the QUARTILE array.

The number of groups, and therefore the number of rows can vary.
The number or rows per group will vary.

Sample Data:
The formula above would be in column D.
(the data is fabricated for example of layout and likely doesn't show real intended formula results.)

Item#DescriptionPercentOutlier
84838Bike Seat7.36%
84838Bike Seat8.45%
84838Bike Seat36.65%Outlier
84838Bike Seat14.10
63233Front Wheel
27.56%Outlier
63233Front Wheel12.07%
63233Front Wheel11.47%
77456Frame6.25%
77456Frame5.76%

<tbody>
</tbody>
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi,

Assuming Item# are in A2:A101, Percent in C2:C101, in D2 and copy down try:
Code:
=IF($A2="","",IF(OR(
$C2 > (QUARTILE(IF($A$2:$A$101=$A2,$C$2:$C$101),3) +
      (1,5*(QUARTILE(IF($A$2:$A$101=$A2,$C$2:$C$101),3) - QUARTILE(IF($A$2:$A$101=$A2,$C$2:$C$101),1)))),
$C2 < (QUARTILE(IF($A$2:$A$101=$A2,$C$2:$C$101),1) -
      (1,5*(QUARTILE(IF($A$2:$A$101=$A2,$C$2:$C$101),3) - QUARTILE(IF($A$2:$A$101=$A2,$C$2:$C$101),1))))),"Outlier",""))
validate with Ctrl+Shift+Enter (array formula)

Regards
XLearner
 
Upvote 0
Sorry XLearner, but I couldn't get this to work. I keep getting the error "We found an error with this formula. . ."
 
Upvote 0
So now how can I apply a dynamic named array so that I do not have to hard-code the final row number?
 
Upvote 0
Hi,

Define the following 3 Named variables (Ctrl+F3):
vLastRow =MAX(ISNUMBER($A$2:$A$1501)*ROW($A$2:$A$1501))
rngItems =INDIRECT(ADDRESS(ROW($A$2),COLUMN($A$2))&":"&ADDRESS(vLastRow,COLUMN($A$2)))
rngPourcentages =INDIRECT(ADDRESS(ROW($A$2),COLUMN($C$2))&":"&ADDRESS(vLastRow,COLUMN($C$2)))

and update the formula accordingly.

If 1501 is not enough adjust to your max expected number of rows but definitively avoid the full column (i.e. ROW($A:$A)) for perf. reasons

Regards
XLearner
 
Upvote 0
I must admit that I don't understand how

Take a basic sample:
AB
1Item%age
284838<strike></strike>7.36%
384838<strike></strike><strike></strike>8.45%
463233<strike></strike>27.56%
563233<strike></strike>12.7%
684838<strike></strike>12.5%

<tbody>
</tbody>

In any cell enter =IF($A$2:$A$6=$A2,$B$2:$B$6) and do not hit Enter
Instead, highlight the complete formula in the formula bar and hit F9
you should see the following array: {0.0736,0.0845,FALSE;FALSE,0.125}

When this IF... is nested into your QUARTILE function, when the formula is calculated this "becomes"
QUARTILE({0.0736,0.0845,FALSE;FALSE,0.125},3)

Hope this helps

Regards
XLearner
 
Upvote 0

Forum statistics

Threads
1,217,047
Messages
6,134,268
Members
449,862
Latest member
Muhamad Irfandi

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