Hello there,
I'm currently working in a very complex worksheet, which takes 15 minutes to calculate (despite my i7 970 cpu). Because I need it to speed up, I'm looking for the following:
See below; the values in the column "implied volatility" are calculated by means of a double condition
- look up value in column in different sheet (Option Data) equal to option ID, in this case W2
- match date in different sheet (Option Data) to date in column S
- Then give me the value in the same row a different column
Code:
=SMALL(IF((W$2='Option Data'!$H$2:$H$50343)*(S4='Option Data'!$B$2:$B$50343);'Option Data'!$G$2:$G$50343);1)
That works all fine, but is quite intensive for my PC.
So what I want to do is:
In the columns next to implied volatility, i.e. "trade volume" and "open int" I want it to show the value in the column next(right) to the value of the implied volatility for which I use the code above.
So instead of using the same small(if()) function, I want to make it easier for the CPU and just use the relative position of the cell which was just looked up in the (optiondata) sheet, and use the cell in the column next to it. Possibly some kind of Offset function might help.
Note: In this example I entered random values in the columns Trade Volume & Open Interest, so don't get confused by that.
Model
R
S
T
U
V
W
1
9-1-2008
3
2
Stock price on t=-20
37850
0.407095583
32763814
3
Date from earnings announcement
Date
Implied Vol
Trade Volu
Open Int
Abnormal Imp Vol
4
-44
5-11-2007
0.39625
354
345
5
-43
6-11-2007
0.388605
354
23
6
-42
7-11-2007
0.403641
4444
32
7
-41
8-11-2007
0.402985
3
4
Excel 2007
Worksheet Formulas
Cell
Formula
R1
=IF( S1=S48,"","DATUMFOUT" )
T2
=AVERAGE( T4:T27 )
Array Formulas
Cell
Formula
S1
=DATEVALUE( IF( INDEX( 'Earnings Data'!$E:$E,( MATCH( $B$3,'Earnings Data'!$E$1:$E$1514,0 )+T$1 ) )=Model!$B$3,( INDEX( 'Earnings Data'!$O:$O,( MATCH( $B$3,'Earnings Data'!$E$1:$E$1514,0 )+T$1 ) ) ) ) )
S2
=1000*( INDEX( 'Stock Prices'!$E$2:$E$70515,MATCH( 1,( Model!S28='Stock Prices'!$B$2:$B$70515 )*( Model!$B$3='Stock Prices'!$C$2:$C$70515 ),0 ) ) )
W2
=INDEX( 'Option Data'!$H:$H,SMALL( IF( ( 'Option Data'!$E:$E>S$2 )*( 'Option Data'!$C:$C>S$63 )*( 'Option Data'!$B:$B=S4 ),ROW( 'Option Data'!$A:$A ) ),1 ) )
S4
=OFFSET( 'Stock Prices'!$B$1,( MATCH( S$1,'Stock Prices'!$B:$B )+R4-1 ),0 )
T4
=SMALL( IF( ( W$2='Option Data'!$H$2:$H$50343 )*( S4='Option Data'!$B$2:$B$50343 ),'Option Data'!$G$2:$G$50343 ),1 )
S5
=OFFSET( 'Stock Prices'!$B$1,( MATCH( S$1,'Stock Prices'!$B:$B )+R5-1 ),0 )
T5
=SMALL( IF( ( W$2='Option Data'!$H$2:$H$50343 )*( S5='Option Data'!$B$2:$B$50343 ),'Option Data'!$G$2:$G$50343 ),1 )
S6
=OFFSET( 'Stock Prices'!$B$1,( MATCH( S$1,'Stock Prices'!$B:$B )+R6-1 ),0 )
T6
=SMALL( IF( ( W$2='Option Data'!$H$2:$H$50343 )*( S6='Option Data'!$B$2:$B$50343 ),'Option Data'!$G$2:$G$50343 ),1 )
S7
=OFFSET( 'Stock Prices'!$B$1,( MATCH( S$1,'Stock Prices'!$B:$B )+R7-1 ),0 )
T7
=SMALL( IF( ( W$2='Option Data'!$H$2:$H$50343 )*( S7='Option Data'!$B$2:$B$50343 ),'Option Data'!$G$2:$G$50343 ),1 )
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}. Note: Do not try and enter these manually yourself
The Option Data sheet from which the Model sheet is extracting data looks like as follows (not including all the 1000000 rows below it):
Option Data
A
B
C
D
E
F
G
H
I
J
1
secid
date
exdate
cp_flag
strike_price
best_bid
volume
open_interest
impl_volatility
optionid
2
100972
1-9-2006
20-1-2007
C
20000
28.4
0
317
21579610
3
100972
1-9-2006
20-1-2007
C
30000
18.6
0
871
21579613
4
100972
1-9-2006
20-1-2007
C
35000
13.7
0
1859
0.261059
21583529
5
100972
1-9-2006
20-1-2007
C
40000
9
11
5660
0.240411
21579611
6
100972
1-9-2006
20-1-2007
C
45000
4.7
0
16325
0.20472
21583315
Excel 2007
My hope is that it will increase the speed of the process, since I have to do this calculation 100 times.