Array Formula that calculates next value

mikec82

Board Regular
Joined
Jan 13, 2009
Messages
225
=INDEX(Data!$E:$E,MATCH($A2,IF(Data!$H:$H=Summary!E$1,Data!$A:$A),0))

An example of the array formula above would be: Return the Course Title if the Student Name is John Smith and the Department is English.

This works for the initial instance.

It only works for the initial instance though. So if John is enrolled in two English courses, it still lists the initial Course.

I have tried the two array formulas below, also with no luck. Any recommendations on where I'm going wrong?

=INDEX(Data!$E:$E,MATCH($A2,IF(Data!$H:$H=Summary!E$1,Data!$A:$A),1))
=INDEX(Data!$E:$E,MATCH($A2,IF(Data!$H:$H=Summary!E$1,Data!$A:$A),+1))
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try

=IFERROR(INDEX(Data!$E$1:$E$1000,SMALL(IF((Data!$H$1:$H$1000=Summary!E$1)*(A2=Data!A$1:A$1000),ROW($A$1:$A$1000)),ROW(A1))-(ROW(A$1)-1),1),"")
Array formula, use Ctrl-Shift-Enter
 
Upvote 0
This still works for the first entry, but if I pull it to the right, it continues to give me the same result.

Here's an example of what I'm getting:

Student / English / English / English / English
John Smith / Literature / Literature / Literature / Literature

Here is what I would like for it to display:

Student / English / English / English / English
John Smith / Literature / Composition / Eng. Lang. / Contemporary Literature

Here is what the Data sheet looks like:

Student / Course / Department
John Smith / Literature / English
John Smith / Composition / English
John Smith / Eng. Lang. / English
John Smith / Contemporary / English
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,764
Messages
6,180,841
Members
453,001
Latest member
coulombevin

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