Complex lookup (newest and oldest data points)

DRExcel515

Board Regular
Joined
Oct 20, 2017
Messages
56
In column A on sheet Calcs I have a distinct list of ticker symbols. On another tab "SQL Dump" I have a much larger data set with all the same ticker symbols but multiple occurances of the symbols (5yrs of monthly data points for each symbol). The formula I want to build starting on the Calcs tab in C2 needs to look up the most recent data point for the symbol in A2 on the SQL Dump tab as well as the oldest data point for that symbol and divide it by the number of months between the two.

Here is the actual formula if that helps..... (Most recent data point - Oldest data point) / # of Months between the two data points

On the SQL Dump tab the data points are in column D starting in row 2 and the ticker symbols are all in order of month end. The trouble I'm having is finding a way to incorporate a lookup to find me the most recent month end for that specific fund, then the oldest available month end and how many months are inbetween as some of the fund symbols may have a full five years of month end data but some may not and there may be a (null) value on some month ends.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
If there isn't really an easy way to build this a workaround I could use would be to look up the most recent data point in one cell then the oldest available data point for that symbol in the next cell and a 3rd cell showing the count of months between those two data points maybe.

Below is how the data is set up on the SQL Dump tab. On the other Calcs tab I would want to lookup the most recent data point (ignoring the (null) in this case below 2.4, then lookup the oldest data point (again ignoring the (null) which would be 1.85 and divide by the number of months between the two points (ignoring the (null) months and in this case that number would be 3 months. Bellow this table is how the calcs tab looks if that helps as well.
ITT
04/30/2013

<tbody>
</tbody>
(null)
ITT05/31/2013(null)
ITT06/30/2013(null)
ITT07/31/20131.85
ITT08/31/20132.5
ITT09/30/20133.2
ITT10/31/20132.4

<tbody>
</tbody>

Calcs Tab:

Formula (Column C)
ITT(2.4 - 1.85) / 3 = .1833333
HYF
HMB
ICT
TLV
MM
IBV

<tbody>
</tbody>
 
Last edited:
Upvote 0
Maybe:

ABCDEF
1TickerDateDataTicker(old-new)/months
2ABC4/30/20131aABC1.8
3DEF4/30/20132dDEF1.666667
4ABC5/31/20133
5DEF5/31/20134
6ABC6/30/20135
7DEF6/30/20136
8ABC7/31/20137
9DEF7/31/20138
10ABC8/31/20139
11ABC9/30/201310a
12DEF9/30/201311
13DEF10/31/201312d

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
SQL Dump

Worksheet Formulas
CellFormula
F2=(LOOKUP(2,1/('SQL Dump'!$A$2:$A$13=E2),$C$2:$C$13)-VLOOKUP(E2,'SQL Dump'!$A$2:$C$13,3,0))/DATEDIF(VLOOKUP(E2,'SQL Dump'!$A$2:$C$13,2,0),LOOKUP(2,1/('SQL Dump'!$A$2:$A$13=E2),$B$2:$B$13),"m")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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