You can use an array formula. In the cell in which you want to get the maximum calculation, enter: = Max (If ([test], [if true], [if false]), where you replace the values in square brackets with the help of the test, what to return if true and what to return if false. For example:
=MAX(IF(MOD(A2:A25,2)=0,A2:A25,0)
In this formula, I return the value in column A if the value divided by 2 has no remainder. Please note that I use the range of cells in my comparison and the value if false, rather than a single cell.
Now, continuing to edit the cell, press Ctrl + Shift + Enter (hold the Ctrl and Shift keys together, then press Enter).
This creates an array formula that acts on each value in the range.
EDIT By the way, did you want to do this programmatically or manually? If programmatically, what environment are you using? VBA? WITH#?
EDIT. VBA FormulaArray R1C1, :
Range("A1").Select
Selection.FormulaArray = "=MAX(IF(MOD(R[1]C:R[24]C,2)=0,R[1]C:R[24]C,0))"