Comparing date in google spreadsheet

0

I am trying to compare dates in a column to the current date using the script below but it gives me undefined status

var toDay = new Date();

if (row[8] = toDay) {Department  == "CRM";}
         else if (row[9] = toDay) {Department == "DRG";}
         else if (row[10] = toDay) {Department == "ESE";}
         else if (row[11] = toDay) {Department == "GRT";}
         else if (row[12] = toDay) {Department == "SEC";}
         else if (row[13] = toDay) {Department == "PLC";}
         else if (row[14] = toDay) {Department == "PPC";}

How am I supposed to achieve this?

francis fernandes

Posted 2016-06-17T19:47:53.343

Reputation: 1

1Questions about web apps like Google Sheets go on our Web Apps site. I've voted to migrate this question there. – Ben N – 2016-06-17T19:53:13.980

Sorry i had made wrong assignment the rectified code is below but it still does not work

var now = new Date().getTime() var Department; if (row[10] == now) {Department = "CRM";} else if (row[11] == now) {Department = "DRG";} else if (row[12] == now) {Department = "ESE";} else if (row[13] == now) {Department = "GRT";} else if (row[14] == now) {Department = "SEC";} else if (row[15] == now) {Department = "PLC";} else if (row[16] == now) {Department = "PPC";} – francis fernandes – 2016-06-17T20:19:47.343

No answers