INDEX/MATCH Query - Amendment needed

Kirstym1918

New Member
Joined
Dec 17, 2017
Messages
45
Hi all,

I have this formula below which INDEXs a list for every date of the year vertically G4:G369, I then created a match for the column next to the date so if the cell has a H, it returns the date from the INDEX range...BUT it keeps returning the same duplicated date over and over when I drag the formula down in to the next cell 38 cells I am using. I know this is what INDEX/MATCH will do but how to I get the formula to move on to the next match if the cell above has already retrieved it?

=INDEX($G$4:$G$369,MATCH($J$1,$H$4:$H$369,0))

Many Thanks
 
It works for me


Excel 2013/2016
GHIJ
3H
401/01/2019W02/01/2019
502/01/2019h04/01/2019
603/01/2019w07/01/2019
704/01/2019h08/01/2019
805/01/2019w09/01/2019
906/01/2019w11/01/2019
1007/01/2019h12/01/2019
1108/01/2019h
1209/01/2019h
1310/01/2019w
1411/01/2019h
1512/01/2019h
1613/01/2019w
Sheet1
Cell Formulas
RangeFormula
J4=INDEX($G$4:$G$34,AGGREGATE(15,6,(ROW($G$4:$G$34)-ROW($G$4)+1)/($H$4:$H$34=$H$3),ROWS($A$1:$A1)))


Is this how your data looks?
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
It works for me

Excel 2013/2016
GHIJ
H
W
h
w
h
w
w
h
h
h
w
h
h
w

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]3[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]01/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"]02/01/2019[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]02/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"]04/01/2019[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]03/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"]07/01/2019[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]04/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"]08/01/2019[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]05/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"]09/01/2019[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]06/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"]11/01/2019[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]07/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"]12/01/2019[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]08/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]09/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]10/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]11/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]15[/TD]
[TD="align: right"]12/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]16[/TD]
[TD="align: right"]13/01/2019[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]J4[/TH]
[TD="align: left"]=INDEX($G$4:$G$34,AGGREGATE(15,6,(ROW($G$4:$G$34)-ROW($G$4)+1)/($H$4:$H$34=$H$3),ROWS($A$1:$A1)))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



Is this how your data looks?

Yes pretty much, I'm probably just being a numpty, what data should A1 refer to at the end of the formula?
 
Upvote 0
It isn't referring to anything, it's basically a count, so in J4 it returns1, J5 returns 2 etc.

AGGREGATE(15,6,...,ROWS($A$1:$A1)))
is basically the same as the small function, so the ROWS section on the end is saying the 1st smallest, 2nd smallest etc
 
Upvote 0
It isn't referring to anything, it's basically a count, so in J4 it returns1, J5 returns 2 etc.

AGGREGATE(15,6,...,ROWS($A$1:$A1)))
is basically the same as the small function, so the ROWS section on the end is saying the 1st smallest, 2nd smallest etc


Its now working, helped that I could look how you worked it out.

Thank you very much Fluff :)
 
Upvote 0
Glad you sorted it & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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