Return MAX result for specific criteria for multiple values

Melchizedek

New Member
Joined
May 4, 2019
Messages
3
I would like a formula that I could lookup and return the latest date. There will be multiple matches, but only want the max one returned. I will have to do this for multiple lines and I have been unable to get Array formula's to work previously
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Welcome to the forums. Please provide an example of what your data set looks like and your expected results.
 
Upvote 0
Tray, ARRAY formula
Code:
=MAX(IF($A$2:$A$9000=A2;$D$2:$D$9000))
or non-array
Code:
=AGGREGATE(14;6;$D$2:$D$9000/($A$2:$A$9000=A2);1)
But a lot of formula slows down Excel, so VBA is faster and does not slow Excel work,
Code:
Sub Macro1()
    Application.ScreenUpdating = False
    Application.CutCopyMode = True
        Range("E2").Select
        ActiveCell.FormulaR1C1 = _
            "=AGGREGATE(14,6,R2C4:R9000C4/(R2C1:R9000C1=RC[-4]),1)"
        Range("E2").Select
            Selection.AutoFill Destination:=Range("E2:E9000")
            Range("E2:E9000").Select
            Selection.Copy
        Range("E2").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
        Range("E1").Select
    Application.ScreenUpdating = True
    Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,771
Messages
6,126,796
Members
449,337
Latest member
BBV123

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