Percentile of x if y is between A and B

mnemosign

New Member
Joined
Jan 15, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I am trying to use Excel to produce box plots using the Percentile function. Let's say I have two arrays Yij and Xij. The idea is to find the median (50th percentile) of the y variable only if the x variable is between A and B. (where y and x are arrays of the same dimensions. Once the median of the y values when x is between A and B is found, the same formula can be used to find the Min,25,75,Max percentiles to create the box plots. Then I can compare the box plots to see if there is a difference between groups when the value of the factor varies. It looks like this:
1705376987525.png


To produce this plot, I use a formula like this:
=percentile(if(A1:E5>=ValueA, if(A1:E5<ValueB,G1:K5)),k)

Let's say my X array is A1:E5 and Y array is G1:K5 - two matrices with the same dimensions. I am seeking a way to find the k percentile of Y when X is between A and B. However I am not sure if the Percentile function works this way with arrays in Excel. Let me know if my approach is correct or if you have any alternate ideas of how I can do this.
 

Attachments

  • 1705376909661.png
    1705376909661.png
    7.3 KB · Views: 25
  • 1705376960373.png
    1705376960373.png
    6.2 KB · Views: 17

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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