I have a spreadsheet that keeps track of how old accounts are by months.
Is there a way to have Google Sheets auto update a cell on the 1st of each month?
VG: An account is 78 months old and on Sept 1st it turns 79 months. I want to automatically update it on the 1st of the month so I won't have to manually add 1 to every account age cell.
This is for Excel:
If the value is 78 on 25 August 2016 and you want the value to increment of the first of each month, then enter:
=78+MONTH(TODAY())-MONTH(DATEVALUE("8/25/2016"))+12*(YEAR(TODAY())-YEAR(DATEVALUE("8/25/2016")))
Assuming that your dataset does include an account start date in column A, you can calculate how many whole months are between that date and system date today by using:
=DATEDIF(A2,TODAY(),"M")
Tested this in Excel but should work in Google Sheets as well.
You could add another field, and do the calculation from the sheet:
[A1]=<start date>
[A2]=datedif(a1,today(),"M")
Otherwise, you could use a script to do this once a month, but you would need a list of cells somewhere that need to be updated. I would need to see an example of your spreadsheet layout to give you working code.
The process would be to:
set a daily trigger
check for the first of the month
if it is, go and update all the cells
if not, try again tomorrow
This worked out well for me in Google Sheets
DATEDIF("<MY_STARTING_DATE>", today(), "M")
example:
DATEDIF("8/1/2021", today(), "M")
Related
I have a column on Google sheets with different dates, I made a dashboard where you can see the upcoming rows with dates within 5 days away from today. It's a box saying "Starting within 5 days" and shows how many rows starts within 5 days. I made it work, the problem is that once we reached the date and passed it, it keeps counting it.
Let's say a row have a cell with the date 2022-10-20 and today is 2022-10-21, that means it already passed the date, so it should stop counting it. It should only count as "1" if the date set in a cell is within 5 days from todays date.
I hope I was clear enough, I use currently =COUNTIF('Under arbete'!C2:C; "<" & today()+5)
your formula
=COUNTIF('Under arbete'!C2:C; "<" & today()+5)
will work only today. every next day it will be offset by +1 day because TODAY will "recalculate" on a daily basis
you can either feed it today's date like:
=COUNTIF('Under arbete'!C2:C; "<"&"2022-10-20"+5)
or try to freeze today's date like:
=COUNTIF('Under arbete'!C2:C; "<"&LAMBDA(x; x)(TODAY()+5))
update:
=COUNTIFS(Kommande!C2:C; ">="&TODAY();
Kommande!C2:C; "<"&TODAY()+10)
for multiple sheets:
=COUNTIFS({Kommande!C2:C; Sheet2!C2:C}; ">="&TODAY();
{Kommande!C2:C; Sheet2!C2:C}; "<"&TODAY()+10)
Good afternoon. I have 2 cells for 2 dates with date format on them and formula =DATE(2022; 1; 19). One cell is a first day of a current week period. Another cell is first day of a next week (=B17+7). I want to make both those cells to automatically change +7 days every week after i enter for example the first current date.
You can use for the first day (monday)
=today()-WEEKDAY(today(),2)+1
One way of solving your need while escaping circular dependency error is to do the following:
Keep cell B17 as is (=B13+7), however, instead of putting a date in cell B13, just put the following formula :
=TODAY()-WEEKDAY(TODAY(),2)+1
The result would be that the 2 cells will always update to the correct dates every time you'd open the spreadsheet.
I know it's basic but I'm new to this. I just want to know how can I calculate the days duration of the two dates?
For example, I have my start date and time 11/22/2021 15:20:43 and end date and time 11/23/2021 14:51:29 I want to calculate the total days from start to end date and time.
Also, If start date time column is BLANK, return to count of days including date today.
Thank you
All you need to do is use the following formula: '=(C2-A2)'. This will give you the elapsed time between the two cells and display it as hours. You can take this calculation further by adding dates too. This is useful if you have work shifts that go more than 24 hours or that include two days within a single shift.
Assuming start dates in column A and end dates in column B, you can try
={"Duration in Days"; Arrayformula(if(len(A2:A) * len(B2:B), datedif(A2:A, B2:B, "d"),))}
Change ranges to suit and see if that works?
EXAMPLE
REFERENCES:
DATEDIF
there is a DAYS formula exactly for that purpose:
update:
=INDEX(IFERROR(1/(1/DAYS(
REGEXREPLACE(TO_TEXT(B1:B), "(.|..)[\/\-\.](.|..)[\/\-\.](.+) (.*$)", "$2\/$1\/$3"),
REGEXREPLACE(TO_TEXT(A1:A), "(.|..)[\/\-\.](.|..)[\/\-\.](.+) (.*$)", "$2\/$1\/$3")))))
demo sheet
I am making a deadline sheet for office.
I have made a conditional format that compares the dates with our "office are closed"-dates provided by our HR-department. If the delivery date match any of the "office closed"-dates in the next column it will be coloured red.
This works fine, but I just noticed one thing. If the date where 1 day before the holidays, and the holidays would be many days a row starting next day, we wouldn't see that and we would probably get big trouble manage Finnish these masters before deadline as we are not at office for a few days.
So, I thought, maybe I could add to the script something that says: "compare the dates in this column with the dates in "Office Closed"-column, if there is a match within a range of 5 days, color it red...?
Is this something I can do?
here is a screenshot of the sheet.
This is the code I use in Conditional Formatting now:
=COUNTIF($L$4:$L$25,H6)>0 which works fine.
Thanks for any help!
/Andreas
Use following formula in CF:
=IF(LEN(A2),SUMPRODUCT((($C$2:$C+3)>=A2)*(($C$2:$C-3)<=A2)))
I'm logging calls, emails and meetings using Google sheets. I am trying to get a chart of results based on a number of days in the past, 7, 30, last month, current month, etc. I am able to do exactly what I need to do using a fixed date but I can't figure out how to convert that to a date range.
Here is what is working:
={ARRAYFORMULA({UNIQUE(FILTER(CRM!M2:M2510,CRM!N2:N2510>=VALUE("2018-06-01 00:00:00"),CRM!N2:N2510<=VALUE("2018-08-01 23:59:59"),CRM!M2:M2510<>"")),ARRAYFORMULA(COUNTIF(FILTER(CRM!M2:M2510,CRM!N2:N2510>=VALUE("2018-06-01 00:00:00"),CRM!N2:N2510<=VALUE("2018-08-01 23:59:59")),SUBSTITUTE(SUBSTITUTE(UNIQUE(FILTER(CRM!M2:M2510,CRM!N2:N2510>=VALUE("2018-06-01 00:00:00"),CRM!N2:N2510<=VALUE("2018-08-01 23:59:59"),CRM!M2:M2510<>"")),"*","~*"),"?","~?")))})}
I need to change the value from a fixed date to a number of days in the past. What do I need to change in this formula? I tried using TODAY() -7 but I keep getting an error saying that I am missing brackets. When I use (TODAY()-7) I just get an #ERROR.
How can I change the VALUE("fixed date") to VALUE(TODAY -7)?
If your data looks like "2018-06-01 00:00:00".
Then use this conditions for filter to filter the last 7 days:
Arrayformula(datevalue(left(CRM!N2:N2510),10))>=datevalue(today()-7)
,
Arrayformula(datevalue(left(CRM!N2:N2510),10))<=datevalue(today())