Formula that searches for item name and calculates 75th percentile of price for all quantity?

aefitzgerald

New Member
Joined
Jan 17, 2018
Messages
8
Hello,

I am trying to pull data from another large spreadsheet (thousands of rows) which is currently sorted to look something like this;

A === B === C === D
Item === Quantity === Price === Running Total Qty.
Apple === 50 === $2.00 === 50
Apple === 100 === $2.25 === 150
Apple === 75 === $2.75 === 225
Banana === 200 === $1.75 === 200
Banana === 300 === $2.00 === 500
Orange === 100 === $0.50 === 100
Orange === 100 === $1.00 === 200
Orange === 50 === $1.25 === 250
Orange === 250 === $1.75 ===500


I am trying to come up with a formula that will allow me to quickly calculate the 75th percentile price for every item AND that takes the quantity into account. E.g. The 75th percentile for Oranges should come out to $1.75 because the 75th percentile of the quantity is sold at that price. I want to quickly populate the B column in a table like the one below (but with thousands of items).


A === B
Item === 75th percentile price
Apple ===
Banana ===
Orange ===


I am able to calculate the 75th percentile for one particular item name in the large spreadsheet by using a formula like this: LOOKUP(SUM(B2:B4)*0.75,D2:D4,C2:C4). However, I am not sure how to search for the item name in another spreadsheet AND calculate the 75th percentile. How can I quickly perform this calculation for many items at once?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Does only one price per group equal or exceed the threshold? If so:


Excel 2010
ABCDEF
1ItemQuantityPriceRunning Total Qty.75th %ile
2Apple50$2.005087.5 
3Apple100$2.2515087.52.25
4Apple75$2.7522587.5
5Banana200$1.75200275
6Banana300$2.005002752
7Orange100$0.50100137.5
8Orange100$1.00200137.5
9Orange50$1.25250137.5
10Orange250$1.75500137.51.75
Sheet7
Cell Formulas
RangeFormula
F2=IF(B2>=E2,C2,"")
E2{=PERCENTILE(IF($A$2:$A$10=A2,$B$2:$B$10),0.75)}
Press CTRL+SHIFT+ENTER to enter array formulas.


Then you can filter, lookup, etc.
 
Upvote 0
I see what you are trying to do there. Unfortunately, it looks like there might be a problem because the result for apples is wrong - it should be $2.75. Any idea why that error is coming up?

Does only one price per group equal or exceed the threshold?
I believe so.
 
Upvote 0
I just tried using those formulas in my spreadsheet. For whatever reason, the F2 formula only produces zeros for every cell in that column...

I am still unable to figure out how to do this.
 
Upvote 0
Why? isn't it below the the 75th %ile quantity (87.5)? Or are we comparing the running total instead of the standalone quantity?
The 75th percentile for the quantity of apples (225 apples) is 168.75. The price of the apples is less than $2.75 for the first 150 apples and $2.75 for the 151st through 250th apples. So the 75th percentile falls in the group with price of $2.75.


What do the numbers in the E column (87.5, 275, 137.5) represent?
 
Upvote 0
=PERCENTILE({50;100;75},0.75) returns 87.5 for apples, how do you get 168.75?

225 x 0.75 = 168.75

The table is already sorted such that the rows for each item are in ascending order by price. Price is the variable that I want to find the 75th percentile for... I created the Running Total Qty column in the hope of making that process easier.
 
Last edited:
Upvote 0
This?


Excel 2010
ABCDE
1ItemQuantityPriceRunning Total Qty.
2Apple50$2.0050 
3Apple100$2.25150
4Apple75$2.752252.75
5Banana200$1.75200
6Banana300$2.005002
7Orange100$0.50100
8Orange100$1.00200
9Orange50$1.25250
10Orange250$1.755001.75
Sheet7
Cell Formulas
RangeFormula
D2=SUMIF($A$2:A2,A2,$B$2:B2)
E2=IF(D2>SUMIF($A$2:$A$10,A2,$B$2:$B$10)*0.75,C2,"")
 
Upvote 0

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