I wanted to make sure I have the correct formula before using it for a report. Could someone validate that this would be the formula to get a date range startdate (col C) to enddate (col D) and the days are indicated in col G. This is a wide range and not limited to one row.

=AVERAGE(IF('Sheet1'!$C:$C>=A8,IF(Sheet'!$C:$C<=C8,'Sheet1'!$D:$D)))

Where A8 is the startdate for the week, and C8 is the enddate for the week on a different work sheet. G specifies the days. The above formula is only for col C though, and I want to add col D with the date range too.