How to Track Previous Dates When Overwriting Cells in Excel
Question details
The user needs to track a history of dates, such as maintenance or cleaning dates, which are currently being overwritten in a single cell, making it difficult to measure frequency.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Managing a maintenance or cleaning log where continually updating a single cell (e.g., D24) replaces the previous date.
- Observed behavior
- Overwriting the cell permanently deletes the previous date, making it impossible to retain a historical record or analyze cleaning frequency.
Decide whether you prefer a simple manual tracking method using tables or an automated approach, and ensure you save a backup of your workbook before applying any VBA macros.
Create a Structured Data Logging Table
The most reliable way to track history is to append new rows for each event instead of overwriting a single cell.
Instead of keeping a static layout where data is continuously overwritten, shifting to a structured database format allows you to keep an infinite history of events.
Create two column headers in a blank area of your sheet, such as 'Bin ID' and 'Cleaning Date'.
Select the headers and press Ctrl+T (or go to Insert > Table) to create a structured table.
Whenever a bin is cleaned, add a new row to the bottom of the table with the corresponding ID and the current date, rather than changing an existing cell.
Use the drop-down arrows on the table headers to filter by specific Bin IDs and view their complete historical timeline.

Automate History Logging with a VBA Macro
If you must retain your existing layout and continue overwriting cell D24, use a Worksheet_Change event to automatically copy the old dates to an adjacent historical row.
Track Data History Seamlessly with WPS Spreadsheet
WPS Spreadsheet offers powerful table features, easy filtering, and full support for VBA macros, making it simple to track your historical data and maintenance logs efficiently.
- 1. Download and Install: Get WPS Office from the official website and launch WPS Spreadsheet.
- 2. Create Your Log Table: Set up columns for ID and Date, select them, and click Insert > Table to begin tracking.
- 3. Enable Macros (Optional): If using the VBA tracking approach, ensure you save your file in the .xlsm format to retain your Worksheet_Change scripts.

Frequently Asked Questions
Can I use formulas to save the previous value of a cell?
No, standard spreadsheet formulas cannot retain the previous value of a cell once it is overwritten. Formulas only calculate based on current data. You must either use a VBA macro or change your data entry method to use a continuous log table.
How do I calculate the days between cleaning dates in a log table?
In a structured table, you can sort by Bin ID and Date, then use a simple subtraction formula (e.g., =B3-B2) in an adjacent column to find the exact number of days between the current and previous dates.
Why is my VBA Worksheet_Change macro not triggering?
Ensure that macros are enabled in your security settings and that your code is placed in the specific Worksheet module rather than a standard module. Also, verify that event triggers haven't been disabled via a previous script using 'Application.EnableEvents = False'.




