Conditional Formatting doesn't recognize timestamp? - google-sheets

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())

Related

How to generate sequences in Google Sheets

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)

Convert written out date (DD.MMMM.YYYY at hh:mm apm) string into date value

Unfortunately, the Google-Sheets sync extension saves the timestamp as a string. (Example: February 6, 2022 at 11:40 pm). Is there any way of automatically converting this automatically to an actual date? I tried the usual date conversion formulas but they dont work. Maybe a work-around?
if a timestamp is in cell A2, try this:
=1*SUBSTITUTE(A2,"at","")
This just gets rid of the word "at" and then multiplying by 1 forces an attempt to convert it into a date value. Then you can just do a regular Format>Number>Date and Time on that cell and it should show how you'd want.
Suppose that your string-dates are in A2:A.
Place the following formula into the Row-2 cell of any other open column (e.g., B2):
=IF(A2:A="",,DATEVALUE(REGEXEXTRACT(A2:A,"^(.+),\s"))+REGEXEXTRACT(A2:A,"\d+:.+$"))

Update: How to calculate date and time duration into Days in google shee? (excluding Sunday)

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

Convert string timestamp mm/dd/yy hh:mm:ss to a date/time type in google sheets

Row 1: cell A is a concat of the date in B and the time in C. I generate these with CTRL+: and CTRL+SHIFT+: respectively. Google sheets does not treat this like a timestamp on the x axis of charts
Row 2: I discovered CTRL+ALT+SHIFT+: to do a full timestamp, now it has a real timestamp
The issue is, I have many rows of recorded data of the type in Row 1 -- is there any way to convert this into a 'time' format that Google Sheets will respect on the x-axis of charts? Using VALUE() just gives the date portion of the timestamp.
Kind of crazy how much trouble this is causing me, is there really no date_parse(string_format) type function I can call?
EDIT:
this is ridiculous, just going to export and use python
instead VALUE use TIMEVALUE and then format it internally to time
or:
=TEXT(TIMEVALUE(A1); "hh:mm:ss")
for arrayformula:
=ARRAYFORMULA(IF(A1:A="",,TEXT(TIMEVALUE(A1:A); "hh:mm:ss")))
for timestamp > date use DATEVALUE

How to utilize date add function in Google spreadsheet?

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.

Resources