Index and Match between Two Dates

matthewlouis

Active Member
Joined
Mar 28, 2014
Messages
374
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hey EXCEL experts, I need a formula for an index and match that looks for a number that is below another cell number. Attached is an image with more explanation. The key is to keep the index / match between the two dates on the sheet in each column.

Thanks in advance!
 
Hey PJ, for presentation, I am reversing the date order (column b) from newest to oldest -- to --- oldest to newest. This affects your formula for the close under AND close over.

Or, I can change the counter so you don't have to do redo that formula. It's currently in Column G a dn it's . . . =IF(LARGE(C5:C11,1)<=C5,1,1+G4) for newest dates to oldest dates. If I change it from oldest date to newest dates, how does that change this counter formula? I can't get it to work.

Thanks!
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Here is what it looks like . . . 88.24, the first price showing it closed over 87.85 . . . but . . . the correct number should 88.03 on 2/20/70.

Again, I reversed the dates . . . and that affected your formula
=IFERROR(INDEX($E$4:$E$13000,LARGE(IF(($A$4:$A$13000>=J30)*($A$4:$A$13000<=L30)*($E$4:$E$13000>I30),ROW($E$4:$E$13000)-ROW($E$3)),1)),"")

Just a reference in case by prior post doesn't make sense.
 

Attachments

  • 772020.png
    772020.png
    42.3 KB · Views: 7
Upvote 0
Well, I think I figured it out . . .

=IFERROR(INDEX($E$4:$E$13000,LARGE(IF(($A$4:$A$13000>=J30)*($A$4:$A$13000<=L30)*($E$4:$E$13000>I30),ROW($E$4:$E$13000)-ROW($E$3)),COUNT(IF(($A$4:$A$13000>=J30)*($A$4:$A$13000<=L30)*($E$4:$E$13000>I30),ROW($E$4:$E$13000)-ROW($E$3))))),"")

This works! Sorry to bother you!
 
Upvote 0
Hi Matthew,

Brilliant that you've managed to make it work. I note though that to do so you've replaced the 1 in your formula at post #32 with the COUNT section
I think that because you've reversed the order you can change that formula simply by changing Large to Small.

You might also consider using Jason's formula:

=IFERROR(INDEX(F:F,AGGREGATE(14,6,ROW($E$4:$E$13000)/($A$4:$A$13000>=J30)/($A$4:$A$13000<=L30)/($E$4:$E$13000>I30),1)) ,"") (PS. I've not been able to try this!)

HTH and congrats on getting yours to work - I think we've both learnt something. Many thanks
 
Upvote 0
Hey pj, I have one more small project using the same data . . . can't seem to make it work. Are you up for it? Wanted to ask first . . .
 
Upvote 0
Of course, but the best course of action is to create a new Thread - its easier for others to engage with - and the wider your audience the more likely you are to have success.
 
Upvote 0
OK, thanks. I will try to use the same data since you should recall it better. Maybe tomorrow, please watch for it, I enjoy working with you!
 
Upvote 0
Haha, have my grandson tomorrow as well. And granddaughter.... resting up!
 
Upvote 0
Will try and new post using the new XLBBB

2020 July 11 Data for PJ.xlsb
ABCDEFGHIJKLMNOPQRSTU
1ABCDEFGHIJKLMNOPQRSTU
2Daily SPHDateDate IndexHighLowCloseDaily VolumeSwing Point High PriceDate of Swing Point HighSwing Point High Volume60 Day Window for "Closed Over" DatePrice Closed Over Swing Point HighDate Price Closed Over Swing Point HighVolume on Date Price Closed Over Swing Point High6 - Day Window for FIRST Test DateFIRST TEST - Index Column D to see if price touched the Swing Point High Price <= Column O Date (6 Days)First Test Date <= 6 BarsIndex Column D - did Price FIRST Test into Swing Point High Price GREATER THAN Column O Date AND LESS THAN Column K DateFirst Test Date > 6 BarsIndex Column D - did Price SECOND Test into Swing Point High Price LESS THAN Column K DateIndex Column D - did Price THIRD Test into Swing Point High Price LESS THAN Column K Date
3
4Daily SPH9/7/16-9652,187.872,179.072,186.163,319,420,0002,187.879/7/20163,319,420,00012/1/20162,198.18 11/21/20163,607,010,00011/30/2016NoNo2,187.4412/1/2016NoNo
5Daily SPH9/8/16-9642,184.942,177.492,181.303,727,840,000
6Daily SPH9/9/16-9632,169.082,127.812,127.814,233,960,000
7Daily SPH9/12/16-9622,163.302,119.122,159.044,010,480,000
8Daily SPH9/13/16-9612,150.472,120.272,127.024,141,670,000
9Daily SPH9/14/16-9602,141.332,119.902,125.773,664,100,000
10Daily SPH9/15/16-9592,151.312,122.362,147.263,373,720,000
11Daily SPH9/16/16-9582,146.482,131.202,139.165,014,360,000
12Daily SPH9/19/16-9572,153.612,135.912,139.123,163,000,000
13Daily SPH9/20/16-9562,150.802,139.172,139.763,140,730,000
14Daily SPH9/21/16-9552,165.112,139.572,163.123,712,090,000
15Daily SPH9/22/16-9542,179.992,170.942,177.183,552,830,0002,179.999/22/20163,552,830,00012/16/20162,180.39 11/15/20164,543,860,00011/23/20162,179.2211/16/2016NoNoNoNo
16Daily SPH9/23/16-9532,173.752,163.972,164.693,317,190,000
17Daily SPH9/26/16-9522,158.542,145.042,146.103,216,170,000
18Daily SPH9/27/16-9512,161.132,141.552,159.933,437,770,000
19Daily SPH9/28/16-9502,172.402,151.792,171.373,891,460,000
20Daily SPH9/29/16-9492,172.672,145.202,151.134,249,220,000
21Daily SPH9/30/16-9482,175.302,156.512,168.274,173,340,0002,175.309/30/20164,173,340,00012/27/20162,180.39 11/15/20164,543,860,00011/23/2016NoNoNoNoNoNo
22Daily SPH10/3/16-9472,164.412,154.772,161.203,137,550,000
23Daily SPH10/4/16-9462,165.462,144.012,150.493,750,890,000
24Daily SPH10/5/16-9452,163.952,155.152,159.733,906,550,000
25Daily SPH10/6/16-9442,162.932,150.282,160.773,461,550,000
26Daily SPH10/7/16-9432,165.862,144.852,153.743,619,890,000
27Daily SPH10/10/16-9422,169.602,160.392,163.662,916,550,0002,169.6010/10/20162,916,550,0001/5/20172,180.39 11/15/20164,543,860,00011/23/2016
28Daily SPH10/11/16-9412,161.562,128.842,136.733,438,270,000
29Daily SPH10/12/16-9402,145.362,132.772,139.182,977,100,000
30Daily SPH10/13/16-9392,138.192,114.722,132.553,580,450,000
31Daily SPH10/14/16-9382,149.192,132.982,132.983,228,150,000
32Daily SPH10/17/16-9372,135.612,124.432,126.502,830,390,000
33Daily SPH10/18/16-9362,144.382,135.492,139.603,170,000,000
34Daily SPH10/19/16-9352,148.442,138.152,144.293,362,670,000
35Daily SPH10/20/16-9342,147.182,133.442,141.343,337,170,000
36Daily SPH10/21/16-9332,142.632,130.092,141.163,448,850,000
37Daily SPH10/24/16-9322,154.792,146.912,151.333,357,320,0002,154.7910/24/20163,357,320,0001/20/20172,163.26 11/9/20166,264,150,00011/17/2016
38Daily SPH10/25/16-9312,151.442,141.932,143.163,751,340,000
39Daily SPH10/26/16-9302,145.732,131.592,139.433,775,200,000
40Daily SPH10/27/16-9292,147.132,132.522,133.044,204,830,000
41Daily SPH10/28/16-9282,140.722,119.362,126.414,019,510,000
42Daily SPH10/31/16-9272,133.252,125.532,126.153,922,400,000
43Daily SPH11/1/16-9262,131.452,097.852,111.724,532,160,000
44Daily SPH11/2/16-9252,111.762,094.002,097.944,248,580,000
45Daily SPH11/3/16-9242,102.562,085.232,088.663,886,740,000
46Daily SPH11/4/16-9232,099.072,083.792,085.183,837,860,000
47Daily SPH11/7/16-9222,132.002,100.592,131.523,736,060,000
48Daily SPH11/8/16-9212,146.872,123.562,139.563,916,930,000
49Daily SPH11/9/16-9202,170.102,125.352,163.266,264,150,000
50Daily SPH11/10/16-9192,182.302,151.172,167.486,451,640,000
51Daily SPH11/11/16-9182,165.922,152.492,164.454,988,050,000
52Daily SPH11/14/16-9172,171.362,156.082,164.205,367,200,000
53Daily SPH11/15/16-9162,180.842,166.382,180.394,543,860,000
54Daily SPH11/16/16-9152,179.222,172.202,176.943,830,590,000
55Daily SPH11/17/16-9142,188.062,176.652,187.123,809,160,000
56Daily SPH11/18/16-9132,189.892,180.382,181.903,572,400,000
57Daily SPH11/21/16-9122,198.702,186.432,198.183,607,010,000
58Daily SPH11/22/16-9112,204.802,194.512,202.943,957,940,000
59Daily SPH11/23/16-9102,204.722,194.512,204.723,418,640,000
60Daily SPH11/25/16-9092,213.352,206.272,213.351,584,600,000
61Daily SPH11/28/16-9082,211.142,200.362,201.723,505,650,000
62Daily SPH11/29/16-9072,210.462,198.152,204.663,706,560,000
63Daily SPH11/30/16-9062,214.102,198.812,198.815,533,980,000
64Daily SPH12/1/16-9052,202.602,187.442,191.085,063,740,000
65Daily SPH12/2/16-9042,197.952,188.372,191.953,779,500,000
66Daily SPH12/5/16-9032,209.422,199.972,204.713,895,230,000
Daily SPH 2016
Cells with Conditional Formatting
CellConditionCell FormatStop If True
T4:U4Cell Value=41229textYES
T4:U4Cell Value=41166textYES
T4:U4Cell Value=41064textYES
T4:U4Cell Value=41229textYES
O4:S4,K4:N965Cell Value=41229textYES
O4:S4,K4:N965Cell Value=41166textYES
O4:S4,K4:N965Cell Value=41064textYES
K4:K965,H4:I965,O4:S4,M4:N965Cell Value=41229textYES
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,176
Messages
6,129,318
Members
449,501
Latest member
Amriddin

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