Obtain Highest Score Based on Two sets of Dated Tests

richh

Board Regular
Joined
Jun 24, 2007
Messages
245
Office Version
  1. 365
  2. 2016
I am trying to match two sets of test scores to find what each student's highest score was in Test A when they took Test B. The expected results are shown in the last two columns of Test Set A. I think I need to do an INDEX MATCH, but I don't know how to incorporate selecting only the rows that have dates on or before the test taken an finding the max value from those selected.

Test Set A is as follows:

StudentIDTestNameTestScoreTestDateHighestTestBMathHighestTestBReading
123Science1008/1/2020100110
123Math999/1/2020200120
123Social Studies1119/9/2020300120


Test Set B is as follows:

StudentIDTestNameTestScoreTestDate
123Math1007/7/2020
123Math2008/7/2020
123Math3009/7/2020
123Reading1107/7/2020
123Reading997/7/2020
123Reading1208/7/2020
123Reading1009/4/2020
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
So far, I have this:

=INDEX('SetB!Table1[[StudentID]:[TestDate]], MATCH(1,([@[St'udentID]]='SetB'!Table1[StudentID])*("Math"='SetB'!Table1[TestName])*([@[TestDate]]>='SetB'!Table1[TestDate]),0),3)

However, that just returns the first row those three conditions are true. The fourth condition I need is hightest test score that matches the three previous conditions.
 
Upvote 0
Please update your user profile to show the version of Excel you're using. It affects the functions that you can use in the result. For example, if you have Excel 2019 or newer, you can use this:

Book1
ABCDEFGHIJKLM
1
2StudentIDTestNameTestScoreTestDateHighestTestBMathHighestTestBReadingStudentIDTestNameTestScoreTestDate
3123Science1008/1/2020100110123Math1007/7/2020
4123Math999/1/2020200120123Math2008/7/2020
5123Social Studies1119/9/2020300120123Math3009/7/2020
6123Reading1107/7/2020
7123Reading997/7/2020
8123Reading1208/7/2020
9123Reading1009/4/2020
10
Sheet1
Cell Formulas
RangeFormula
F3:F5F3=MAXIFS(Table2[TestScore],Table2[StudentID],[@StudentID],Table2[TestName],"Math",Table2[TestDate],"<="&[@TestDate])
G3:G5G3=MAXIFS(Table2[TestScore],Table2[StudentID],[@StudentID],Table2[TestName],"Reading",Table2[TestDate],"<="&[@TestDate])


If you have an older version, you may need to use an array formula like this:

Book1
ABCDEFG
1
2StudentIDTestNameTestScoreTestDateHighestTestBMathHighestTestBReading
3123Science1008/1/2020100110
4123Math999/1/2020200120
5123Social Studies1119/9/2020300120
Sheet1
Cell Formulas
RangeFormula
F3:F5F3=MAX(IF((Table2[StudentID]=[@StudentID])*(Table2[TestName]="Math")*(Table2[TestDate]<=[@TestDate]),Table2[TestScore]))
G3:G5G3=MAX(IF((Table2[StudentID]=[@StudentID])*(Table2[TestName]="Reading")*(Table2[TestDate]<=[@TestDate]),Table2[TestScore]))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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