Populate an Excel Report from Another Worksheet by Selected Month
Question details
Populate a monthly report with matching weather and attendance records from another worksheet, with separate sections for the current and previous year.

- 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.
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.
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.
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.
On the report worksheet, enter the month number in C3, such as 3 for March.
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.
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.
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.

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. Open the workbook: In WPS Spreadsheet, open the XLSX workbook and select the EOD - History worksheet.
- 2. Add the helper formula: Enter the helper-key formula shown above in A3 and fill it down alongside the history records.
- 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. 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.

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.




