Here is the answer in case anyone is interested.
function formatting(m, d) {
try {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1'); // get the sheet
var output = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet2'); // output sheet
output.clear()
// Going to need the column for project type
var counts = {};
var eValues = sheet.getRange(1, 3, sheet.getLastRow(), 1).getValues();
var columnF = sheet.getRange(1, 1, sheet.getLastRow(), 1).setBackgroundColor('white'); // get all the rows and clear colors
var columnG = sheet.getRange(1, 2, sheet.getLastRow(), 1).setBackgroundColor('white'); // get all the rows and clear colors
var columnD = sheet.getRange(1, 4, sheet.getLastRow(), 1).setBackgroundColor('white').clearContent(); // get all the rows and clear colors
var columnCritical = sheet.getRange(1, 7, sheet.getLastRow(), 1).setBackgroundColor('white').clearContent(); // get all the rows and clear colors
var fValues = columnF.getValues(); // get the values
var gValues = columnG.getValues();
var day = 24 * 3600 * 1000
// loop through all the rows in the dataset
for (var r = 0; r < (fValues.length - 1); r++) {
var startDay1 = parseInt(fValues[r][0].getTime() / day);
var endDay1 = parseInt(gValues[r][0].getTime() / day);
// loop through all the rows for given date
for (var z = 0; z < (fValues.length - 1); z++) {
var startDay2 = parseInt(fValues[(z)][0].getTime() / day);
var endDay2 = parseInt(gValues[(z)][0].getTime() / day);
// if the date is the same go to the next one
if (startDay1 == startDay2 && endDay2 == endDay1) continue;
// check for conflicts
else if (startDay1 < endDay2 && startDay2 < endDay1) {
//Here is our conflict!!!;
var projectn = r + 1
if (counts[projectn] !== undefined) { // strict(!) comparison
// add one to this projects count
counts[projectn] += 1;
} else {
// create the first count for this project
counts[projectn] = 1;
}
} else {
// if there is no conflict
}
} //end of for loop for var z
// change the background of the counts to red and set values
if (counts[r + 1] == undefined) {
sheet.getRange(r + 1, 4, 1, 1).setValue(counts[r + 1]).setBackground('green');
} else {
sheet.getRange(r + 1, 4, 1, 1).setValue(counts[r + 1]).setBackground('red');
}
} // end of for loop for var r
// show if there is any errors
} catch (e) {
Logger.log(e.lineNumber + ' - ' + e);
}
}