Can't figure out a max if

szita2000

Board Regular
Joined
Apr 25, 2012
Messages
101
Office Version
  1. 365
Platform
  1. Windows
Hi guys.
For the love of my life I can't work out a Max if formula.

What I am trying to achieve here is to get the correspondent value from C to the latest date in column A.
My idea was to get an array of the same fruits, then with the max get the largest date.
Then try to match index match it.


Book1.xlsx
ABCDEF
112/06/2020Apple12Apple11
212/06/2020Pears22Pears11
312/06/2020Oranges32Oranges11
413/06/2020Apple13
513/06/2020Pears23
613/06/2020Oranges33
714/06/2020Apple11
814/06/2020Pears24
914/06/2020Oranges34
Sheet1
Cell Formulas
RangeFormula
F1:F3F1=INDEX($C:$C,MATCH(MAX(IF($B:$B=$E1,$A:$A,"")),$A:$A,0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Change to:

=INDEX($C:$C,MATCH(MAX(IF($B:$B=$E1,$A:$A,"")),IF($B:$B=$E1,$A:$A,""),0))
 
Upvote 0
@szita2000
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

For example, if you have Excel 365 with the FILTER & SORT functions, you could also try something like below - column F.
I have also included another option in column G, not requiring Excel 365) but assuming your data is sorted by date as per your sample..

If you are sticking with INDEX/MATCH/MAX formula I would recommend not using whole column references. I doubt you are using anything like 1,000,000+ rows and asking Excel to compare that many values in column B with the value in column E (twice) is consuming a lot more resources that most likely required. Even when I copy that formula down just the 3 rows I can see a noticeable lag before the results appear.

20 07 07.xlsm
ABCDEFG
112/06/2020Apple12Apple1111
212/06/2020Pears22Pears2424
312/06/2020Oranges32Oranges3434
413/06/2020Apple13
513/06/2020Pears23
613/06/2020Oranges33
714/06/2020Apple11
814/06/2020Pears24
914/06/2020Oranges34
10
Latest
Cell Formulas
RangeFormula
F1:F3F1=INDEX(SORT(FILTER(A$1:C$20,B$1:B$20=E1),1,-1),1,3)
G1:G3G1=INDEX(C$1:C$20,AGGREGATE(14,6,(ROW(C$1:C$20)-ROW(C$1)+1)/(B$1:B$20=E1),1))
 
Upvote 0
Thanks Peter. Added the missing info. ANd the 365 solution is Brilliant!
Many thanks again!
 
Upvote 0
You're welcome. Thanks for the follow-up. :)

And thanks for updating your profile. (y)
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

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