formula to extract the records with oldest date and another criteriia

GerryZ

Well-known Member
Joined
Jul 4, 2014
Messages
1,224
Office Version
  1. 365
Platform
  1. Windows
hello Excel gurus
I'm stuck
All I need a formula in F2 to copy across and down that choose
from the first criteria (AAA) the oldest date in (AAA) and than ritrieve the name of the student and the corrisponding date
I Made a formula with INDEX MAX IF but does't work


Book1
ABCDEFG
1criteriostudentdateacriteriostudentoldest data
2aaastudent115/01/2015aaastudent217/01/2018
3aaastudent217/01/2018bbbstudent522/01/2016
4aaastudent316/01/2015cccstudent1112/04/2016
5bbbstudent415/01/2014
6bbbstudent522/01/2016
7bbbstudent618/01/2015
8bbbstudent718/01/2014
9bbbstudent821/01/2014
10cccstudent907/06/2015
11cccstudent1014/07/2015
12cccstudent1112/04/2016
13cccstudent1213/02/2015
14cccstudent1311/03/2015
Sheet5
 
Thank You Both
Both formula works fine
but I will use STEVE the Fish Formula because is conceptually easier to understand and I will make it simple Without CSE because i will use AGGREGATE LARGE....1 ect ...ect
Thank you Both you solved me a problem
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
this is how i will arrange steve the fish formula without CSE

=INDEX(B$2:B$14,MATCH(AGGREGATE(14,6,$C$2:$C$14/($A$2:$A$14=$E2),1),$C$2:$C$14,0))

thank you again
 
Upvote 0
I will make it simple Without CSE because i will use AGGREGATE

Yes - that is a sensible and perfectly valid idea.

Let us know if you need help creating the equivalent AGGREGATE construction.

Regards
 
Upvote 0
Ah, no! Wait! There is a flaw with these two solutions:

=INDEX(B$2:B$14,MATCH(MAX(IF($A$2:$A$14=$E2,$C$2:$C$14)),$C$2:$C$14,0))

=INDEX(B$2:B$14,MATCH(AGGREGATE(14,6,$C$2:$C$14/($A$2:$A$14=$E2),1),$C$2:$C$14,0))

and that is, because the conditional statement is not also employed within MATCH's lookup_array, it is not guaranteed to give correct results.

For example, in your dataset, change the value in C3 from 17/01/2018 to 22/01/2016. What results do you get using these two formulas for the student name?

Whereas I believe my formula will still give correct results.

Regards
 
Upvote 0
The point is that, with these constructions as they stand, there is nothing to say that the maximum value in column C which corresponds to a column A entry of e.g. "bbb" does not also occur within column C, but for a different column A entry, e.g. "aaa".

And if the case for "aaa" happens to occur in a row which precedes that for "bbb", then MATCH will evidently - and undesirably - return the date corresponding to that value instead.

In order to be certain of correct results, steve the fish's array formula should be:

=INDEX(B$2:B$14,MATCH(MAX(IF($A$2:$A$14=$E2,$C$2:$C$14)),IF($A$2:$A$14=$E2,$C$2:$C$14),0))

i.e. we must repeat the conditional statement for the lookup_array also, to ensure that cases where the column A entry is different to that being sought are excluded.

Unfortunately, there is no simple means to convert this version into an AGGREGATE-based one. And so (and not to blow my own trumpet!), I would prefer my solution is this instance.

Regards
 
Upvote 0
Thank You XOR LX
Just last thing..
Your formula works fine but the problem is that your formula are very ADVANCED they are few steps above the regular formula (too cleaver)
so let's say for some people (like me) Excel is allready difficult and the best think to do when is possible is to find a formula with easier sintax and more understandable.
Your Excel level is very ADVANCED and all your formula works perfectly and I saw in your website the way you expalin the formula EXCELLENT!
but when i lookup for a formula I don't need just COPY and PASTE but i need to understand the formula
ciao GerryZ
 
Upvote 0
The point is that, with these constructions as they stand, there is nothing to say that the maximum value in column C which corresponds to a column A entry of e.g. "bbb" does not also occur within column C, but for a different column A entry, e.g. "aaa".

And if the case for "aaa" happens to occur in a row which precedes that for "bbb", then MATCH will evidently - and undesirably - return the date corresponding to that value instead.

In order to be certain of correct results, steve the fish's array formula should be:

=INDEX(B$2:B$14,MATCH(MAX(IF($A$2:$A$14=$E2,$C$2:$C$14)),IF($A$2:$A$14=$E2,$C$2:$C$14),0))

i.e. we must repeat the conditional statement for the lookup_array also, to ensure that cases where the column A entry is different to that being sought are excluded.

Unfortunately, there is no simple means to convert this version into an AGGREGATE-based one. And so (and not to blow my own trumpet!), I would prefer my solution is this instance.

Regards

I was looking what it would do with ties for date as well!
 
Upvote 0

Forum statistics

Threads
1,216,076
Messages
6,128,670
Members
449,463
Latest member
Jojomen56

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