How to Find Missing Fund Price Data Points Using Excel VBA
Question details
Identify missing hourly fund price records between specific timeframes (10:00 to 17:00) across a large Excel dataset.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Analyzing extensive financial datasets where hourly fund prices must be strictly complete for selected analysis dates.
- Observed behavior
- The user needs an automated VBA solution to verify data completeness by generating a report of missing fund-date-time combinations, rather than manually scanning rows.
Ensure your dataset is saved as an Excel Macro-Enabled Workbook (.xlsm) and that you have enabled the Developer tab to access the VBA editor.
Use a Custom VBA Macro to Filter and Check Missing Times
Automate the search for missing hours (10:00 to 17:00) by grouping data by fund and date using a VBA script.
Writing a macro allows you to iterate through your analysis sheet's specific start and end dates. The code will logically check each required hour and compile a list of any gaps in the dataset.
Press ALT + F11 in Excel to launch the Visual Basic for Applications (VBA) editor.
Click 'Insert' in the top menu and select 'Module' to create a new blank script window.
Write your VBA script to loop through the selected dates and funds. Use an inner loop for the required hours (e.g., For hr = 10 To 17) and check if a corresponding record exists in your dataset.
Configure the script to write any missing fund-date-time combinations into a new worksheet named 'Missing Data Report'.
Press F5 or click the 'Run Sub/UserForm' button on the toolbar to execute the code and instantly view your missing data.
Identify Missing Data Visually Using PivotTables
Use PivotTables as a no-code alternative to quickly spot gaps in your hourly data.
Analyze and Verify Financial Data Efficiently with WPS Office
WPS Spreadsheet provides powerful data analysis capabilities, including advanced PivotTables and full support for executing Excel VBA macros, making data integrity checks fast and seamless.
- 1. Open Your Data: Launch WPS Spreadsheet and open your financial dataset.
- 2. Access the Developer Tools: Navigate to the Developer tab and click 'Macros' or 'Visual Basic' to open the script editor.
- 3. Paste the VBA Code: Insert a module and paste your missing data verification macro.
- 4. Run and Report: Execute the macro directly in WPS to seamlessly generate your missing fund data report.

Frequently Asked Questions
Why is my VBA macro not running correctly in my spreadsheet?
Your macro security settings might be restricting execution. Go to your software's Trust Center or Macro Security settings and select 'Enable all macros' while working on trusted files, or ensure your file is unblocked in Windows File Properties.
How can I adjust the VBA script to check different trading hours?
You can modify the numerical boundaries in your VBA loop. For example, if your code uses 'For hr = 10 To 17', change it to 'For hr = 9 To 16' to check the hours between 09:00 and 16:00.
Can I flag missing data directly in my raw dataset instead of a new report?
Yes, you can use Conditional Formatting in combination with advanced formulas (like COUNTIFS) to highlight missing combinations directly, though VBA is often much faster for massive datasets with hundreds of thousands of rows.




