This answer is if you go straight to a Google Sheet.
I think this will help in getting you going in the right direction. I'm unclear if you're saying that fields you'll be monitoring are sprinkled around the sheet, or if the non-adjacent cells you referenced were just examples inside a range. If you have cells sprinkled around, you will likely have to make multiple "watch range"s as I have noted in the code, and check that the cell being edited is inside at least one range, otherwise return out of the function.
I want to note that I didn't go to the extra length to make this work for supporting deleting all values from a multi-cell range.
Also, note that you will have to go into Tools -> Script Editor inside the Google Sheet, and then Resources -> Triggers (menu may be different depending what you've done in there before) and add an "onEdit()" trigger to the Sheet.
Then, your function will go something like this
function onEdit(e){
var DateCol = "K";
var DeletedColNote = "L";
var curDate = Utilities.formatDate(new Date(), "GMT-5", "MM/dd/yyyy")
var editRange = e.range;
var rowIndex = editRange.getRowIndex();
var colIndex = editRange.getColumnIndex();
// May need to set up multiple ranges like this and check all ranges if
// checked fields are not in adjacent cells
var watchRange = { // B2:G20
top : 2, // start row
bottom : 20, // end row
left : 2, // start col
right : 7 // end col
};
// Exit if we're out of range
if (rowIndex < watchRange.top || rowIndex > watchRange.bottom) return;
if (colIndex < watchRange.left || colIndex > watchRange.right) return;
var currentValue = editRange.getValue();
currentValue = currentValue.replace(/^\s+|\s+$/g,""); //"trim" kludge
if (currentValue.length == 0)
{
// Set a column to show when data was deleted
SpreadsheetApp.getActiveSheet().getRange(DeletedColNote + rowIndex).setValue("Deleted: " + curDate);
}
else
{
// Set a column to show last edit date
SpreadsheetApp.getActiveSheet().getRange(DateCol + rowIndex).setValue("Edited: " + curDate);
SpreadsheetApp.getActiveSheet().getRange(DeletedColNote + rowIndex).setValue("");
}
}
1What do you mean by "it will be used on Google Drive"? Will you convert it to Google Sheets format or you will use the Office Compatibility Mode? – Rubén – 2016-04-13T17:44:05.277
Since this is for an Excel file, it makes no difference where you store it. Microsoft Excel is off-topic here. This should be asked at [su]. – ale – 2016-04-13T18:21:51.503