Return a Project Total When a Year Falls Within a Date Range in Excel
Question details
Return a project total when a year in a column header falls within the project's start and end dates.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet has project totals in column J, start dates in column AD, end dates in column AE, and years in headers beginning at AF1.
- Observed behavior
- Each year column should show the project total when its header year is between the start and end years, inclusive, and remain blank otherwise.
Check that AD and AE contain valid Excel dates and that the column headers, such as AF1, contain numeric years. Confirm that the project total is in column J, or adjust the formula references to match your worksheet.
Use IF and YEAR to Match the Project Date Range
Use this formula to display the project total for every header year covered by the project's start and end dates.
Select cell AF2 and enter =IF(AND(YEAR($AD2)<=AF$1,YEAR($AE2)>=AF$1),$J2,"").
Drag the fill handle from AF2 across the remaining year columns to compare each header year with the same project's dates.
Select the completed formula cells in row 2 and drag the fill handle down through the remaining project rows.

Return Project Totals by Year in WPS Spreadsheets
Use the same IF, AND, and YEAR formula in WPS Spreadsheets to show a project total under each year covered by its date range.
- 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
- 2. Check the worksheet layout: Confirm that column J holds totals, columns AD and AE hold start and end dates, and AF1 contains a numeric year.
- 3. Enter the formula: Select AF2 and enter =IF(AND(YEAR($AD2)<=AF$1,YEAR($AE2)>=AF$1),$J2,"").
- 4. Copy the formula: Drag the fill handle across the year columns and down the project rows.

Frequently Asked Questions
Does the formula include the start and end years?
Yes. The <= and >= comparisons include both the year of the start date in AD and the year of the end date in AE.
Why is the formula returning a blank?
Check that the numeric year in AF1 falls between the years of the dates in AD2 and AE2. If it does not, the formula returns an empty string.
Why does the full project total appear in multiple years?
The formula returns the full value from J2 for every matching header year. It does not allocate or prorate the total across the date range.
Can I use different columns for the dates and total?
Yes. In the formula entered in AF2, replace $AD2, $AE2, and $J2 with references to your start date, end date, and total columns. Update AF$1 if your first year header is in a different column.




