Function Problems

Populate an Excel Report from Another Worksheet by Selected Month

Aamir Naveed AkramAamir Naveed Akram Nov 25, 2026 868 views

Question details

Populate a monthly report with matching weather and attendance records from another worksheet, with separate sections for the current and previous year.

Populate an Excel Report from Another Worksheet by Selected Month
Product
Microsoft Excel
Device & OS
not provided
Scenario
A month selected in cell C3 determines which records are retrieved from the EOD - History worksheet.
Observed behavior
The report should display all matching records for the selected month in each year's section.
Before you start

Make sure C3 contains a month number from 1 to 12 and that the history dates are valid Excel dates. The example assumes dates are in column B, the fields to return are in columns B through F, and column A is available for a helper key.

Solution 1Recommended

Use a helper column and VLOOKUP to retrieve monthly records

Use this method to return multiple records for the selected month in separate previous-year and current-year sections.

The helper key combines the year, month, and occurrence number of each record. COUNTIFS assigns a sequence within each month, so VLOOKUP can retrieve records one at a time in their source-sheet order.

The formulas use the current calendar year from TODAY(). Adjust the year expressions if the report should use a different reference year.

1
Create the helper key

On EOD - History, enter this formula in A3 and fill it down for every data row: =YEAR(B3)&"_"&MONTH(B3)&"_"&COUNTIFS($B$3:B3,">="&EOMONTH(B3,-1)+1,$B$3:B3,"<"&EOMONTH(B3,0)+1). The upper boundary also includes dates with time values on the last day of the month.

2
Select the report month

On the report worksheet, enter the month number in C3, such as 3 for March.

3
Populate the previous-year section

In the first output cell, such as A8, enter =IFERROR(VLOOKUP((YEAR(TODAY())-1)&"_"&$C$3&"_"&ROWS($A$8:A8),'EOD - History'!$A:$F,COLUMN(A1)+1,FALSE),""). Fill it across through column E and down through the rows reserved for this section.

4
Populate the current-year section

In the first cell of the current-year section, such as A20, enter =IFERROR(VLOOKUP(YEAR(TODAY())&"_"&$C$3&"_"&ROWS($A$20:A20),'EOD - History'!$A:$F,COLUMN(A1)+1,FALSE),""). Fill it across through column E and down through the rows reserved for this section.

5
Check the results

Compare the report with EOD - History for the selected month and format the returned date column as a date using Home > Number Format if necessary. Leave enough rows in each section for all matching records.

Use a helper column and VLOOKUP to retrieve monthly records
Adjust the example ranges: If the current-year section starts in a different row, replace both A20 references in its ROWS expression with that starting cell. If the source columns differ, adjust the lookup range and column index; the helper key must remain the first column of the lookup range.
Work with monthly reports in WPS

Build the same monthly lookup report in WPS Spreadsheet

Use a helper column and VLOOKUP in WPS Spreadsheet to pull matching monthly records into separate report sections.

  1. 1. Open the workbook: In WPS Spreadsheet, open the XLSX workbook and select the EOD - History worksheet.
  2. 2. Add the helper formula: Enter the helper-key formula shown above in A3 and fill it down alongside the history records.
  3. 3. Set the month and formulas: On the report worksheet, enter a month number in C3, then enter the previous-year and current-year VLOOKUP formulas in their respective starting cells.
  4. 4. Fill and review: Fill each formula across and down its report section, check the results, and use File > Save As to save the workbook as an XLSX file.
Retrieve multiple records for a selected month using a helper keySeparate current-year and previous-year resultsOpen and save Microsoft Excel XLSX filesUse familiar spreadsheet formulas and worksheet navigation
microsoft office alternative - wps office

Frequently Asked Questions

What should I enter in C3 to select a month?

Enter a number from 1 to 12, such as 3 for March. The example formulas compare that number with the month number in the helper key.

How does the formula return more than one record in a month?

COUNTIFS assigns each matching source row an occurrence number. As the VLOOKUP formula is filled down, ROWS increases the occurrence number in the lookup key.

Why are some report cells blank?

IFERROR displays a blank when no matching key is found, including after the last matching record. If expected records are missing, check C3, the source dates, the filled helper formulas, and the lookup range.

Can I report on a year other than the current year?

Yes. Replace YEAR(TODAY()) in the report formulas with a year cell reference, such as $C$4. Use $C$4-1 for the previous-year section and $C$4 for the selected year.