Hi,
As Jed mentions, more context is better, but I think I see what you want.
In case (1), a maximum, but only among those differences less than or equal to zero.
In case (2), a minimum, but only among those differences between 0 and 14, inclusive.
In case (3), a minimum, but only among those differences 15 or greater.
If this is what you want, then in each case you can use the same idea:
1) Dynamically set the data you DON'T want to missing, and then
2) Compute the max or min of the data, while ignoring the missing data.
In the code below, each formula has the same structure:
Col <<max or min>> ( If ( I want to ignore the data, make it missing, else use the original data), <<grouping variable>> ).
So which data do we want to ignore?
In case ( 1 ), it is :diff > 0... any difference greater than 0
In case ( 2 ), it is ! ( 0 <= :diff <= 14)... any difference not between 0 and 14 inclusive
In case ( 3 ), it is :diff < 15... any difference less than 15
Running the code you will see a table like the one below. In my code, the grouping column is the "person" column... and I've just simulated the differences, as from your description that's the column of interest.
Cheers,
Brady
Names Default To Here( 1 );
nr = 50;
dt = New Table( "ex",
New Column( "Person", character, <<set values( Words( "abcde", "" )[J( nr, 1, Random Integer( 1, 5 ) )] ) ),
New Column( "diff", <<set values( J( nr, 1, Random Integer( -10, 30 ) ) ) )
);
dt << sort( by( :person, :diff ), order( ascending, ascending ), replace table );
dt << New Column( "form_1", formula( Col Max( If( :diff > 0, ., :diff ), :Person ) ) );
dt << New Column( "form_2", formula( Col Min( If( !(0 <= :diff <= 14), ., :diff ), :Person ) ) );
dt << New Column( "form_3", formula( Col Min( If( :diff < 15, ., :diff ), :Person ) ) );