Array or other Formulas to Determine Price and Volume Count

Steve=True

Well-known Member
Joined
May 27, 2011
Messages
993
Hi, I have a set of data.

Date........Price........Volume
7am.........99............10
701am......98.............2
702am......98.5..........12
etc.
Record set of 46k rows so looking for the most efficient formula.

I want to graph the volume shifts but struggling with an efficient formula to do these things:

If we set a price watch target of $10

A) Sum the volume every time the data shifts more than or equal to the price watch target of $10

Example
Row2= Price at 7am = 99
Row56=Price at 756am = 109
Sum of Volume from 7am-756am = 479

Row56=Price at 756am = 109
Row402=Price at 902am = 119
Sum of Volume from 7am-756am = 961

Row402=Price at 902am = 109
Row421=Price at 915am = 109
Sum of Volume from 7am-756am = 1461

I want to plot a graph of this data

xaxis 756am.....479 volume (datapoint)
xaxis 902am.....961 volume (datapoint)
xaxis 915am.....1461 volume (datapoint)

Thanks in advance!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
If I've understood, perhaps something along the lines of:


Excel Workbook
ABCD
1TimePriceVolumeChart
207:009922#N/A
307:019827#N/A
407:029341#N/A
507:039827#N/A
607:049538#N/A
707:059747#N/A
807:06986#N/A
907:0710142#N/A
1007:081037#N/A
1107:0910445#N/A
1207:1010912314
1307:1110947#N/A
1407:121071#N/A
1507:1311036#N/A
1607:1411336#N/A
1707:1511835#N/A
1807:1612350205
1907:1712222#N/A
2007:181209#N/A
Sheet1
 
Upvote 0
Thanks much Donkeyote, you are wonderful and that formula will work, however, i may run into a calculation problem as this formula needs to be copied down all 45,000 rows.

I would probably look for the first X number of occurances between certain time ranges. (lets say 50 points total)

Any thoughts on how i can optimize the spreadsheet to only calculate so many data points between the time range?

Steve
 
Upvote 0
The formula is relatively efficient... it should be noted that the SUMIF section will only be applied where the volume variance exceeds permitted boundaries (10)

If you wish to apply the test only a given number of times you can add a pre-emptive COUNT:

Code:
D2:
=IF(COUNT($D$1:$D1)=50,NA(),IF(ABS($B2-INDEX($B:$B,IF(COUNT(D$1:D1)=0,2,MATCH(9.99E+307,$D$1:$D1))))<10,NA(),SUM($C$2:$C2)-SUMIF($D$1:$D1,"<>#N/A")))

If you wish to remove the formulae altogether you may be best served using VBA and subsequently working with VBA Arrays.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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