I'l like to create a sequence of dates using "sequence formula" with a start and end date. I mean, something like this:
start date = 2020-01-01
end date = 2022-12-01
I just also want to bring the first day of the month, like the following example:
2020-01-01
2020-02-01
2020-03-01
......
2022-10-01
2022-11-01
2022-12-01
How can I get this? Is there another way to do it?
Thanks!!!
There are several ways to approach this. Here is one I recommend:
=ArrayFormula(DATE(2020,SEQUENCE(DATEDIF("2020-01-01", "2022-12-01", "m")+1),1))
You'll replace the first 2020 with the year of your starting date and the next two string-dates with your full start and end date. That's it.
Just make sure you leave enough cells open below this formula to accommodate the number of dates you're requiring the formula to output.
Format the output range in the date format you prefer (Format > Number...).
Simple SEQUENCE() should work. Try-
=SEQUENCE((B1-A1)+1,1,A1)
Related
i am using a code for timestamp link here.
The issue is when i am trying to condtional format the row base on date i.e today it isnt working =$A1=today() what might be the issue
Conditional Formatting doesn't recognize timestamp?
you can find the sample sheet here link
The dates are calculated as a counting from 30/12/1899. For example, 29/12/2022 is expressed as 44924:
The hours, minutes and seconds are expressed as a fraction of a day:
So, as suggested you should keep the INT part or ROUNDDOWN the value of the TIMESTAMP in order to match TODAY's date (that is an integer without decimals):
=INT($A1)=TODAY()
=ROUNDDOWN($A1)=TODAY()
can you try:
=INT($A1)=today()
try:
=($A1*1<=TODAY()+1)*($A1*1>TODAY()-1)
or:
=INT($A1)=TODAY()
and see: https://stackoverflow.com/a/66201717/5632629
timestamp upon range edit:
=LAMBDA(x; x)(IFERROR(B1:1/0)+NOW())
I'm trying to work this out, can't find a solution.
The string, after REGEXEXTRACT is 20:00 24:00 25:00
I've been banging my head for hours, trying ways to convert, after the split, to get this result:
20:00
24:00
25:00
But it turns out that Google Sheets always forces:
20:00
24:00:00
25:00:00
Tried converting to text, using arrayformula, formatting cell as custom date, etc. Nothing has worked, so far.
Here a sheet example, already with the SPLIT result and the desired result.
https://docs.google.com/spreadsheets/d/12VISJZCSehTax8IJ88H4fmQ7Yoit6hENaI2WD_Sb2y8/edit?usp=sharing
Any clues?
Thanks! ;)
I edited D14:F14 to get the result you want. You just needed to set the format for the output range to durations not military time:
Format > Number > Custom number format > [h]:mm
you can force it:
=ARRAYFORMULA(TEXT(SPLIT(D10; " "); {"[h]:mm"\ "[h]:mm"\ "[h]:mm"}))
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 believe the issue I am having now should be much easier in MS Excel. However, since my company uses Google Spreadsheet so I have to figure out a way.
Basically, I have a cell that contains a date value like "12/19/11", and I have another cell contains a value like "DT 30". The task assigned to me is to add the value 30(days) to the date, so the result should be "1/19/2012".
I did some trying in Google Spreadsheet, I have two questions. The first is to how to extract the numeric value "30" out of the string "DT 30", the second question is that, there seems to be no date add function built in Google Docs.
Could any experts offer some suggestions?
I like to keep it simple. If A1 holds the date and B1 holds the number of months to add, then
=date(year(A1),month(A1)+B1,day(A1))
would calculate the required result. The same way could be used for days or years
To extract a numeric value out of your string you can use these 2 functions (Assuming you have your value in cell 'A1'):
=VALUE(REGEXEXTRACT(A1, "\d+"))
This will get you a numeric value.
I've found no date add function in docs, but you can convert your date into internal date number and then add days number (If your value is in cell 'A2'):
=DATEVALUE(A2) + 30
I hope this will help.
You can just add the number to the cell with the date.
so if A1: 12/3/2012 and A2: =A1+7 then A2 would display 12/10/2012
You can use the DATE(Year;Month;Day) to make operations on date:
Examples:
=DATE(2013;3;8 + 30) give the result... 7 april 2013 !
=DATE(2013;3 + 15; 8) give the result... 8 june 2014 !
It's very surprising but it works...
The direct use of EDATE(Start_date, months) do the job of ADDDate.
Example:
Consider A1 = 20/08/2012 and A2 = 3
=edate(A1; A2)
Would calculate 20/11/2012
PS: dd/mm/yyyy format in my example
As with #kidbrax's answer, you can use the + to add days. To get this to work I had to explicitly declare my cell data as being a date:
A1: =DATE(2014, 03, 28)
A2: =A1+1
Value of A2 is now 29th March 2014
Using pretty much the same approach as used by Burnash, for the final result you can use ...
=regexextract(A1,"[0-9]+")+A2
where A1 houses the string with text and number
and A2 houses the date of interest
what's wrong with simple add and convert back?
if A1 is a date field, and A2 hold the number of days to add:
=TO_DATE((DATEVALUE(A1)+A2)
=TO_DATE(TO_PURE_NUMBER(Insert Date cell, i.e. AM4)+[how many days to add in numbers, e.g. 3 days])
Looks like in practice:
=TO_DATE(TO_PURE_NUMBER(AM4)+3)
Essentially you are converting the date into a pure number and back into a date again.
In a fresh spreadsheet (US locale) with 12/19/11 in A1 and DT 30 in B1 then:
=A1+right(B1,2)
in say C1 returns 1/18/12.
As a string function RIGHT returns Text but that can be coerced into a number when adding. In adding a number to dates unity is treated as one day. Within (very wide) limits, months and even years are adjusted automatically.