Finding MAX number based on 2 criteria in a series without helper column...

seaottr

Board Regular
Joined
Feb 10, 2010
Messages
60
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

With help from the internet, I was able to find out the first and last test attempt for a user using an array formula, but I'm having trouble adapting it to look at TWO criteria (Name and Course). Because it is only currently looking at name, users that attempt Course 2 more times than Course 1, won't show a last attempt for Course 1 (and vice versa).


I'm hoping you can help me adapt the following array formula to look at both Name and Course to find out if a cell's value is the MAX in the series (preferably WITHOUT a helper column).

Current Formula (in F2):
{=IF(E2=1,"First", IF(E2=MAX(IF(A:A=A2,E:E)),"Last",""))}

Sample Table:
ABCDEFG
NameCourseQuestion #Correct?Attempt #First or Last Attempt?Notes
JohnCourse 11N1First
JohnCourse 12Y1First
JohnCourse 13N1First
JohnCourse 11N2
JohnCourse 12N2
JohnCourse 13Y2
JohnCourse 11Y3 <-- This should be last attempt for Course 1, but is taking last attempt for Course 2 because it's only comparing against Name, not Name AND Course
JohnCourse 12Y3 <-- This should be last attempt for Course 1, but is taking last attempt for Course 2 because it's only comparing against Name, not Name AND Course
JohnCourse 13Y3 <-- This should be last attempt for Course 1, but is taking last attempt for Course 2 because it's only comparing against Name, not Name AND Course
MaryCourse 11Y1First
MaryCourse 12N1First
MaryCourse 13N1First
MaryCourse 11Y2Last
MaryCourse 12Y2Last
MaryCourse 13Y2Last
JohnCourse 21N1First
JohnCourse 22N1First
JohnCourse 23N1First
JohnCourse 24Y1First
JohnCourse 21Y2
JohnCourse 22N2
JohnCourse 23Y2
JohnCourse 24N2
JohnCourse 21N3
JohnCourse 22Y3
JohnCourse 23Y3
JohnCourse 24N3
JohnCourse 21Y4Last
JohnCourse 22Y4Last
JohnCourse 23Y4Last
JohnCourse 24Y4Last
MaryCourse 21Y1First
MaryCourse 22Y1First
MaryCourse 23Y1First
MaryCourse 24Y1First

<tbody>
</tbody><colgroup><col span="2"><col><col><col><col><col></colgroup>
 

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
You shouldnt use full column references as they will be slow in array formulas. You need to nest in an additional IF.

=IF(E2=1,"First", IF(E2=MAX(IF($A$2:$A$1000=A2,IF($B$2:$B$1000=B2,$E$2:$E$1000))),"Last",""))
 
Upvote 0
Thanks so much for the solution Steve! This worked and it looks like it's something I should have been able to solve myself, but totally couldn't...LOL! I understand the recommendation to not use full column references in array formulas. There are thousands of rows that get added weekly, but I'm actually using tables, so it's just using the table columns, not full worksheet columns for the formulas. I didn't use a table for the example just to make it simpler to read :)

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,215,419
Messages
6,124,796
Members
449,189
Latest member
kristinh

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