I am trying to write a script that will replace the following formula:
=ARRAYFORMULA(IF((BM3:BM <> "") * (BN3:BN <> ""), BM3:BM + BN3:BN,))
This is where I am at so far:
function Formula_Columns() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
ss.getRange("BP3").setFormula("=BM3 + BN3");
var lr = ss.getLastRow();
var fillDownRange = ss.getRange(3,68,lr-2);
ss.getRange("BP3").copyTo(fillDownRange);
}
What I would like to happen is when the date is entered into column BM the formula will combine the date in column BM with the time set in column BN and place it into column BP. I need the script to add the function into BP only when a cell in BM has a date in it. As the script is written now, it enters 12/30/1899 0:00:00 if there is no date and time entered in column BM & BN respectively. (See screenshot below)
I would appreciate some help with this. Thank you in advance.

