Volume weighted price, bottom/top percentile

jcooooper

Board Regular
Joined
Mar 24, 2018
Messages
74
Office Version
  1. 365
Platform
  1. Windows
I am trying to find the volume weighted average price of the bottom 25% of the overall quantity.

In this example, there are 240 share lots for sale, I need just the average price of the bottom 25% of the overall quantity.

Is there any easy way to do calculate this? I've included a picture for reference and the data in the table below

PriceQuantitybottom 25%QuantityPriceTotal(Cumulative Quantity)
298.52​
5​
=first 60 shares
5​
298.52​
1492.6​
5​
300​
30​
30​
300​
9000​
35​
300​
20​
20​
300​
6000​
55​
300​
16​
5​
300​
1500​
60​
300​
5​
total
60
17992.6​
300​
5​
302.91​
30​
Volume weighted price =
302.91​
8​
Total / shares
302.91​
7​
17992.6/60
302.91​
7​
Result:299.8766667
302.91​
6​
302.91​
5​
302.91​
5​
302.91​
3​
305​
30​
305​
12​
305​
10​
307​
36​
total
240
 

Attachments

  • bottom_VWAP.PNG
    bottom_VWAP.PNG
    22.5 KB · Views: 7

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I added your Price and Quantity values into a table, which is unceremonously called Table3. I added two simple columns: one for the Cumulative Quanity, and one for the Index (or row in the table - we'll need this later on). The last column First60Shares does most of the work here. The main body of that function is
Excel Formula:
=IF([@[Cumulative Quantity]]>SUM([Quantity])/4,SUM([Quantity])/4-INDEX([Cumulative Quantity],[@Index]-1),[@Quantity])
> If the Cumulative Quantity is > 25% of the total, return 25% of the total - the Cumulative Quantity of the previous row (essentially calculating the portion of the current row that is to be carried over to equal 25% of the total), otherwise just return the regular quantity).

Note that you can do this without the table, but in my opinion the formulas become much more easier to read and you do not have to worry about constantly extending the formulas if rows are added/removed - they always refer to every row in the table. You could also clean up a little if you want by adding some extra logic to First60Shares to show blank if its value is < 0, but I didn't want to complicate things further for now.

MrExcel.xlsm
ABCDE
1PriceQuantityCumulative QuantityIndexFirst60Shares
2298.525515
33002025220
43003055330
5300167145
63005765-11
73005816-16
8302.91301117-21
9302.9181198-51
10302.9171269-59
11302.91713310-66
12302.91613911-73
13302.91514412-79
14302.91514913-84
15302.91315214-89
163053018215-92
173051219416-122
183051020417-134
193073624018-144
SheetName
Cell Formulas
RangeFormula
C2:C19C2=SUM($B$2:B2)
D2:D19D2=ROW([@Quantity])-1
E2:E19E2=IF([@[Cumulative Quantity]]>SUM([Quantity])/4,SUM([Quantity])/4-INDEX([Cumulative Quantity],[@Index]-1),[@Quantity])


You can then finish everything out with one formula somewhere else in your worksheet: Sumproduct the Price and First60Shares columns, but only the rows where First60Share is > 0.
Excel Formula:
=SUMPRODUCT(IF(Table3[First60Shares]>0,Table3[Price],0),Table3[First60Shares])
This gives us 17992.6 as expected.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,772
Messages
6,126,814
Members
449,339
Latest member
Cap N

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