Home > OS >  How to get the every week by google spread sheet
How to get the every week by google spread sheet

Time:02-07

I want to have date of every weeks.

I put 07/02/2022 in F5 cell and put =EDATE(F5 7) in G5 cell

But N/A comes in G5

I guess maybe I put 07/02/2022 in F5 in a wrong way..

What should I do?

CodePudding user response:

  1. read the error message:

Wrong number of arguments to EDATE. Expected 2 arguments, but got 1 arguments.

  1. correct G5 to =EDATE(F5,7)

In case you refer to tomorrow's date, that is 2/7/2022. You are, if you read the help, adding 7 months with the command above.

CodePudding user response:

The date of the next week starting on any day

function nextWeekDateStartingOnThis(day = 1) {//Sun(0) - Sat(6)
  let dt = new Date();
  let nd = new Date(dt.getFullYear(), dt.getMonth(), dt.getDate()   7 - dt.getDay()   day);
  Logger.log(nd);
  return nd;//this returns the date of the next monday because day = 1
}

If you want the date of the next tuesday then make day = 2

  •  Tags:  
  • Related