I suggest that you take each of the functions below, and look them up in the Scripting Index, and study the examples given for each of them
Help==>Scripting Index
Here is my explanation of the formula I passed to you
// Create a pointer to the data table so it can be referenced in the
// "Get Rows Where" function
dt = Current Data Table();
// The formula is applied to each row of the data table
// setting tYear equal to :Year sets the value of tYear to the
// Year for the current row. This is a little trick that allows
// for the "Get Rows Where" function to have something to compare to
tYear = :Year;
// For the current row, check to see if the current rows value of Date
// falls between January 1st and October 5th for the current year
If( Date MDY( 1, 1, :Year ) >= :date <= Date MDY( 10, 5, :Year ),
// If it is in between those dates then calculate the Mean of
// the column for Value where all the rows where Week is equal
// to the current row's value of week, and where all the rows where
// Year is equal to the current rows value of year
temp = Col Mean( :Value, :Week, :Year )
,
// If the current row's date isn't between the dates above, then
// find all of the rows where Week is equal to week 39, and year is
// equal to the row;'s current year. Then find the mean of those values
temp = Mean( :Value[dt << get rows where( :Week == 39 & tYear == :Year )] )
);
// The value that JMP returns to a formula is the last value exeuted in the formula
// Therefore, by placing the variable "temp" as the last thing seen, the
// calculated value of temp is what the formula value is
temp;
Jim