Function Problems

Return a Project Total When a Year Falls Within a Date Range in Excel

Ayan MasoodAyan Masood Nov 18, 2026 869 views

Question details

Return a project total when a year in a column header falls within the project's start and end dates.

Return a Project Total When a Year Falls Within a Date Range in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Enter the formula

Select cell AF2 and enter =IF(AND(YEAR($AD2)<=AF$1,YEAR($AE2)>=AF$1),$J2,"").

2
Fill across the year columns

Drag the fill handle from AF2 across the remaining year columns to compare each header year with the same project's dates.

3
Fill down for other projects

Select the completed formula cells in row 2 and drag the fill handle down through the remaining project rows.

Use IF and YEAR to Match the Project Date Range
Totals are not prorated: The formula includes both the start and end years and repeats the full value from column J for each matching year. It does not divide the total among years.
Work with project dates in WPS Spreadsheets

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. 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
  2. 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. 3. Enter the formula: Select AF2 and enter =IF(AND(YEAR($AD2)<=AF$1,YEAR($AE2)>=AF$1),$J2,"").
  4. 4. Copy the formula: Drag the fill handle across the year columns and down the project rows.
Compare header years with project start and end dates.Fill the formula across years and down project rows.Open and edit Microsoft Excel XLSX and XLS files.Work in a familiar spreadsheet interface.
microsoft office alternative - wps office

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.