dimanche 23 mai 2021

Google Sheets App Script If Else Function

Create a function named validateHours(). The function has a single parameter named reference. The function should examine the value of parameter named reference.This function should return Valid if reference is between 0 and 24 inclusive, otherwise it should return Invalid. Return to the sheet and enter your new formula into cell B2. Copy the formula and paste into B3:B6. Each of the cells in column B should now show the values Valid or Invalid.

function validateHours(reference) {
  let result; 
  if (reference => 0 && reference <= 24) {
    result = "Valid";
  } else {
    result = "Invalid";
  }
  return result;
}

Can someone tell me what's wrong with my code?

Aucun commentaire:

Enregistrer un commentaire