INDEX MATCH multiple criteria greater than or equal to

johnsnider

New Member
Joined
Aug 23, 2018
Messages
9
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Subject[/TD]
[TD]score[/TD]
[/TR]
[TR]
[TD]1000[/TD]
[TD]Math[/TD]
[TD]80[/TD]
[/TR]
[TR]
[TD]1001[/TD]
[TD]English[/TD]
[TD]45[/TD]
[/TR]
[TR]
[TD]1002[/TD]
[TD]Math[/TD]
[TD]60[/TD]
[/TR]
[TR]
[TD]1002[/TD]
[TD]English[/TD]
[TD]87[/TD]
[/TR]
[TR]
[TD]1001[/TD]
[TD]English[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]1000[/TD]
[TD]Chem[/TD]
[TD]54[/TD]
[/TR]
[TR]
[TD]1001[/TD]
[TD]Math[/TD]
[TD]71[/TD]
[/TR]
[TR]
[TD]1002[/TD]
[TD]Chem[/TD]
[TD]83[/TD]
[/TR]
</tbody>[/TABLE]



[TABLE="width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Name[/TD]
[TD]Age[/TD]
[/TR]
[TR]
[TD]1000[/TD]
[TD]matt[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]1001[/TD]
[TD]john[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]1002[/TD]
[TD]simon[/TD]
[TD]16[/TD]
[/TR]
</tbody>[/TABLE]


This solution needs to be a formula that must be within one cell and needs to be dynamic(e.g changes).

Q1
What is the lowest score received in Math for students above the age of 15?

Q2
Return the 2nd letter for the name of a student with the lowest average score?


So Far I tried using something like this however it fails =INDEX(A2:C9,MATCH(MIN(IF(AND(B2:B11="MATH",A11:A13=IF(C11:C13>15,A11:A13),C2:C9)),A2:A11,0),2)
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Maybe something like one of these.
The formula in C18 needs Excel 2016 or 365.
The formula in C19 will work in any ver.

These are array formulas and must be entered with
Excel Workbook
ABC
1IDSubjectscore
21000Math80
31001English45
41002Math60
51002English87
61001English50
71000Chem54
81001Math71
91002Chem83
10
11
12
13IDNameAge
141000matt12
151001john15
161002simon16
17
1860
1960
CTRL-SHIFT-ENTER.
 
Upvote 0
AhoyNC thank you for the help, much appreciated your formula worked beautifully. Is there any chance you could explain to me the logic behind it, I am a bit confused about how it works. Also, did you know way to solve Q2. So far I have this =MIN(AVERAGEIF(A2:A11,A14:A16,C2:C1)) which gives me the lowest average but doesn't leave a reference for me to find the ID.
 
Upvote 0
AhoyNC thank you for the help, much appreciated your formula worked beautifully.
Are you sure?

In my sample data below I have changed matt's age. Shouldn't the answer still be 60, not 80?

Excel Workbook
ABC
1IDSubjectscore
21000Math80
31001English45
41002Math60
51002English87
61001English50
71000Chem54
81001Math71
91002Chem83
10
11
12
13IDNameAge
141000matt18
151001john15
161002simon16
17
1880
1980
Lowest
 
Upvote 0
Hey, Peter thank you for checking, you're right. The method only finds the first person above 15. By any chance would you know a method to fix this.
 
Upvote 0
You could try this user-defined function. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

Code:
Function MinScore(rScores As Range, rAges As Range, sSubject As String, lAgeLimit As Long) As Variant
  Dim d As Object
  Dim aScores As Variant, aAges As Variant
  Dim i As Long
  
  Set d = CreateObject("Scripting.Dictionary")
  aScores = rScores.Value
  aAges = rAges.Value
  For i = 1 To UBound(aAges)
    d(aAges(i, 1)) = aAges(i, 3)
  Next i
  sSubject = LCase(sSubject)
  MinScore = "N/A"
  For i = 1 To UBound(aScores)
    If LCase(aScores(i, 2)) = sSubject Then
      If d(aScores(i, 1)) > lAgeLimit Then
        If aScores(i, 3) < MinScore Then MinScore = aScores(i, 3)
      End If
    End If
  Next i
End Function

Excel Workbook
ABC
1IDSubjectscore
21000Math80
31001English45
41002Math60
51002English87
61001English50
71000Chem54
81001Math71
91002Chem83
10
11
12
13IDNameAge
141000matt18
151001john15
161002simon16
17
1860
Lowest
 
Upvote 0
Thank you for the solution, much appreciated it worked but is it possible for there to be a solution that doesn't use a macro-enabled workbook. It has to work just using the default Excel formulas.
 
Upvote 0
Assuming each student has at most one score for each subject, try this. (I haven't tested heavily)

Excel Workbook
ABC
1IDSubjectscore
21000Math80
31001English45
41002Math60
51002English87
61001English50
71000Chem54
81001Math71
91002Chem83
10
11
12
13IDNameAge
141000matt18
151001john15
161002simon16
17
1860
Lowest
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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