Function which isn't working: =QUERY(A:B, "SELECT A WHERE B > " & D1, 0)
What it's looking at:
A
B
Strings
13 Feb 2023
Strings
18 Feb 2023
Strings
21 Feb 2023
Cell D1 =
10 Feb 2023
Trouble shooting:
The query is coming up no results. All dates are numbers, when I format them as numbers instead of dates it works, when I format them as DD MMM, it works, but when I format them as DD MMM YYYY it doesn't work and this is the format I need it in.
Question
Why is Query so sensitive to date formats?? I always use different date formats depending on the sheet and vlookup has no issue with this. Also why on earth would it just not accept one format? I really want to learn for future
for query you may use:
=QUERY(A:B, "SELECT A WHERE B > date'"&text(D1,"yyyy-mm-dd")&"'")
if you wish to avoid the query confusion; you may just go with simple filter Fx
=filter(A:A,B:B>D1)
Related
I have this row in Google Sheets with the year and Week yyyy-ww which starts at week "0".
A B C D E
1 2022-00 2022-01 2022-02 ... 2023-00
How do I convert to a "Date Range" like this in Google Sheets?
A B C D E
1 Dec 26 - Jan 1 2 Jan - 8 Jan 9 Jan - 15 Jan ... ...
I'm not sure if this is what you are looking for but this is a math formula that gets you your results. Paste it in A2 and it will spill over through all the columns.
=ARRAYFORMULA(IF(A1:1<>"",TEXT(DATE(LEFT(A1:1,4),1,1)+(7*RIGHT(A1:1,2)-6),"mmm dd")&" - "&TEXT(DATE(LEFT(A1:1,4),1,1)+(7*RIGHT(A1:1,2)),"mmm dd"),""))
You could then copy and paste the values over your original row. Assuming you want to convert your current format over to this new format permanently.
If you are looking for a way to literally format the cell, I do not believe that is possible from a yyyy-ww format.
UPDATE:
If curious, a shorter version using LAMBDA would look like:
=ARRAYFORMULA(LAMBDA(a,IF(a>0,TEXT(a,"mmm dd")&" - "&TEXT(a+6,"mmm dd"),""))(DATE(LEFT(A1:1,4),1,1)+(7*RIGHT(A1:1,2)-6)))
can you try this out:
=BYCOL(A1:G1,LAMBDA(ax,LAMBDA(s,w,LAMBDA(z,iz,IFS(iz=1,text(MAX(z)-6,"MMM D")&" - "&text(MAX(z),"MMM D"),iz=53,text(MIN(z),"MMM D")&" - "&text(MIN(z)+6,"MMM D"),(iz<>1)+(iz<>53),text(MIN(z),"D MMM")&" - "&text(MAX(z),"D MMM")))(FILTER(s,w=--RIGHT(ax,2)+1,YEAR(s)=--LEFT(ax,4)),FILTER({w},w=--RIGHT(ax,2)+1,YEAR(s)=--LEFT(ax,4))))(SEQUENCE(DAYS("12/31/2025", "1/1/2020")+1,1,DATE(2020,1,1)),INDEX(WEEKNUM(SEQUENCE(DAYS("12/31/2025", "1/1/2020")+1,1,DATE(2020,1,1)))))))
I am looking for a formula that will automatically convert a column of ordinal date/time values into standard date/time values.
July 1st 2022 6:48:49 pm
July 2nd 2022 10:03:35 am
July 3rd 2022 5:41:12 pm
July 4th 2022 2:44:13 pm
I need to get those reformatted to eliminate the st, nd, rd, and th portions.
Sheet
You can use
=INDEX(IF(A2:A7="",, REGEXREPLACE(A2:A7,"st|nd|rd|th","")*1))
You can then format as you like
(Do adjust the formula according to your ranges and locale)
Functions used:
INDEX
IF
REGEXREPLACE
I have a column with dates and time formatted like this in each cell:
Thursday, Jan 21, 2021 4:30 PM-5:00 PM
I want to split this across two columns so that the first column has "DD/MM/YY" and the second has the timeslot.
So it would go from being a cell with:
Thursday, Jan 21, 2021 4:30 PM-5:00 PM
to two cells:
21/01/21 4:30 PM-5:00 PM
What formula can I use in Google Sheets to achieve this?
Another suggestion (which assumes here that your raw data runs A2:A):
=ArrayFormula(IF(A2:A="",,SPLIT(REGEXREPLACE(A2:A,"^\w+, (.+\d) (\d.+$)","$1~$2"),"~")))
This will leave your dates in the first column as numeric raw dates rather than as text, so you'd be able to use them in calculations and comparisons later. Just select the first column of the results (i.e., those raw dates, showing as numbers in th 40000 range) and format the entire column (Format > Number) in the date format you prefer.
use:
=INDEX(IFNA(TEXT({REGEXEXTRACT(A1:A, ", (.+\d{4})")*1,
REGEXEXTRACT(A1:A, "\d{4} (.+)")}, {"dd/mm/yyyy", "#"})))
I'm using Zapier to input timestamps of emails to Google Sheets. The format I'm seeing in Google Sheets is:
Wed, 28 Jun 2017 21:02:51 +0000 (UTC)
Is there a way to either change this (in Google Sheets) to 2017-06-28 21:02:51 or to help date-related functions to understand this format?
You should be able to extract date from string:
=DATEVALUE(REGEXEXTRACT("Wed, 28 Jun 2017 21:02:51 +0000 (UTC)","\d+ [A-Za-z]{3} \d{4}"))
REGEXEXTRACT part extracts "28 Jun 2017". Then format the result as date.
Edit:
Getting closer :) Error DATEVALUE parameter '28 Jun 2017' cannot be
parsed to date/time.
I think this is bacause of your regional settings.
Option: writing script, my solution wont work.
Option: Change File → Regional Settings to US.
Option: modify the formula so it replaces english names of monthes into their numbers. This would produce ugly big formula.
I have a really big spreadsheet in google docs. I have a collumn with time in UTC format. For instance (2013, 10, 14, 12, 17) for 14 Oct 2013, 12:17 am
I want to change it to ISO 8601. I have started to change them one by one, but the data is huge. Is there any other way to do it automatic?
If you want to turn (2013, 10, 14, 12, 17) (assumed in A1) into a more conventional format:
=SPLIT(mid(A1,2,len(A1)-2),",")
to populate B1:F1 then:
=date(B1,C1,D1)+(E1+F1/60)/24
to convert to a date time index recognised by Google Sheets. The result might be formatted:
dd MMM yyyy, HH:mm AM/PM
to show: 14 Oct 2013, 12:17 PM
or formatted otherwise by choice (ISO 8601 does not require a unique format).
This does not attempt to address any strange convention for the likes of 12:17 (ie treats that as 17 minutes after noon, not after midnight) nor any time difference due to location.