I want to use a Linest function to regress Y on X, but my date range will change and I would like to have it update automatically. If I have start and stop dates in column A, Y values in column B and X values in column C, how do i write the code to say something like:

Linest(if(and(date>=start, date<=end),y-values), if(and(date>=start, date<=end),x-values))

where start and end are named ranges that I will update to change the date ranges.

Thanks!