VBA & Macro Problems

How to Find Missing Fund Price Data Points Using Excel VBA

Muhammad TalhaMuhammad Talha Nov 11, 2026 868 views

Question details

Identify missing hourly fund price records between specific timeframes (10:00 to 17:00) across a large Excel dataset.

How to Find Missing Fund Price Data Points Using Excel VBA
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press ALT + F11 in Excel to launch the Visual Basic for Applications (VBA) editor.

2
Insert a New Module

Click 'Insert' in the top menu and select 'Module' to create a new blank script window.

3
Define the Time Checking Logic

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.

4
Output the Missing Data

Configure the script to write any missing fund-date-time combinations into a new worksheet named 'Missing Data Report'.

5
Run the Macro

Press F5 or click the 'Run Sub/UserForm' button on the toolbar to execute the code and instantly view your missing data.

Data Layout: The exact syntax of your VBA code will depend heavily on your workbook's column layout (e.g., which columns hold the Date, Time, and Fund Name).

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. 1. Open Your Data: Launch WPS Spreadsheet and open your financial dataset.
  2. 2. Access the Developer Tools: Navigate to the Developer tab and click 'Macros' or 'Visual Basic' to open the script editor.
  3. 3. Paste the VBA Code: Insert a module and paste your missing data verification macro.
  4. 4. Run and Report: Execute the macro directly in WPS to seamlessly generate your missing fund data report.
Fully compatible with Microsoft Excel formats, including macro-enabled .xlsm filesBuilt-in VBA editor to run and edit custom macrosAdvanced PivotTables for quick, visual data groupingLightweight software with an intuitive, familiar user interface
microsoft office alternative - wps office

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.