get the next date based on frequency set using google sheet formula - google-sheets

I need to display the upcomind date based on the start date and frequency set.
I have tried with
=TODAY() + MOD(TODAY() - C2, F2)
Here is the sheet

Could try:
G2 + F$2-MOD(G2 - C$2, F$2)
where G2 is today's date

Answer:
The upcoming date is given by:
=((((((C2-DATE(1970,1,1))*86400)+(((D2-DATE(1970,1,1))*86400)-((C2-DATE(1970,1,1))*86400))/H2)/60)/60)/24)+DATE(1970,1,1)
This is equivalent to:
(end date) - (start date)
(start date) + ___________________________
(frequency)
Where each date is converted to a unix timestamp for calculation and converted back to date format for display.
Remember that frequency will have to be decremented when each upcoming date passes in order to update the formula to the new upcoming date.
References:
DATE - Docs Editors Help
Unix Time - Wikipedia

Related

Switch date and month google sheet

I have a data column which date in this format 05/12/2021 = dd/mm/yyyy but google sheet see it as 05/12/2021 = mm/dd/yyyy, how can I use a formula to switch the day and month around and display as 5/12/2021 = d/mm/yyyy. It has to be done on a formula level as there are many other dates column that has the format and information right.
Formula tried
=TEXT(A3:A,"d/mm/yyyy")
If the date is entered correctly, you should be able to format it by going to the 'Format' menu.
However, if you need to transpose the formatted day and month using formula, then try this in row 3 (any column but A):
=arrayformula(datevalue(regexreplace(to_text(A3:A),"(.|..)[\/\-\.](.|..)[\/\-\.](.*)","$2\/$1\/$3")))

How to Use formula to insert Month to Date Automatically

I want to use a single formula in cell A2 to insert Month to date Automatically. (in descending order). Only show date within this month (September)
For example, Today is 9/2/2021.
It will show:
9/2/2021
9/1/2021
Let's say we entering the next day 9/3/2021.
It will show:
9/3/2021
9/2/2021
9/1/2021
https://docs.google.com/spreadsheets/d/1Rq7_yGZjXEqN84BIKmmZ0a8qlcPF2ZIgvdCD2aorGKc/edit?usp=sharing
Thank you so much for your help.
Try this in A2 based on the date from B1:
=arrayformula(sort((eomonth(B1,-1))+(sequence(B1-eomonth(B1,-1),1)),1,0))
or this using today():
=arrayformula(sort((eomonth(today(),-1))+(sequence(today()-eomonth(today(),-1),1)),1,0))

Sheets Get value from the earliest/latest date and time from column

I have a table that is filled with dates and values.
I have 2 columns. One with date in format YYYY-MM-DD HH:MM:SS. Another with percentage number.
I need to automatically calculate the difference between the last value (percentage number) in month (date and time, for example 2021-03-11 22:55:00) and first value (percentage number) in month (date and time, for example 2021-03-10 03:04:00).
Also I need to automatically calculate the difference between the first value (percentage number) in current month (date and time, for example 2021-03-11 22:55:00) and first value (percentage number) in previous month (date and time, for example 2021-03-10 03:04:00).
He is the table
https://docs.google.com/spreadsheets/d/1_zxoGv02ki1qYdngMP28QGc0VxA3BfNzn7vyX1yA0q8/edit?usp=sharing
With red I highlighted desired values. With yellow needed result.
Last Date - First date
First Date - First date
You can use a mix of FILTER(), MAX(), MIN(), and EDATE() in this case.
For Last Date - First Date, you can try using this formula:
=FILTER(B:B, A:A=MAX(A:A)) - FILTER(B:B, A:A=MIN(A:A))
As for the First Date - First Date, you can try using this one. This works on the sample sheet that you've provided:
=MIN(FILTER(B:B, A:A > EDATE(MIN(A:A), +1))) - FILTER(B:B, A:A=MIN(A:A))

Calculate Saturday Before X In Google Sheets

I have a need in Google Sheets to calculate the date of the Saturday prior to a given date.
e.g. If I were to give todays date of 16/04/17, it should return 15/04/17.
Thanks
Please try:
=A1-weekday(A1)
weekday

How to write a query in Google Spreadsheet that returns date >= today?

I am writing the following =filter formula in Google spreadsheet:
=FILTER('Tab'!6:1963, ‘Tab’!E6:E1963 = "Major", ’Tab’!D6:D1963 > NOW())
Column D are dates and I am interested in including today. For instance today is the 7/19 and I would like to have the data that includes 7/19. My current formula returns values only from tomorrow (7/20). I tried the now()-1 but returned an #VALUE!.
Any help?
NOW() returns a datetime object (which includes the time). If you are comparing with a date, NOW() will (almost :) ) always be greater than the date alone (which would have a time component of 12:00 A.M., which is essentially 0).
Try using TODAY() to get the date only (adding/subtracting 1 will use tomorrow/yesterday, respectively).

Resources