Dates standardization in Google sheets using formulas - google-sheets

I have some raw data coming from a system. the issue is that system exports the dates using the US formating to be as M/D/YYYY meanwhile all my sheets using dates as DD/MM/YYYY or D/M/YYYY. i tried using this formula
=text(TO_DATE(DATEVALUE('Row Data'!A2)),"M/D/YYYY")
and then the date changes from e.g. 6/1/2021 to 1/6/2021 (here for June 2021) but after the date is becoming 1/6/2021 i think the other formulas are still reading the date as if it is already the same as 6/1/2021.
Here is a sheet that has some data that I'm struggling with Dates Standardization
So any idea how to fix this mess?
Appreciate your help <3

Based on the formula you've already tried, does this work instead?
=date(regexextract(to_text('Row Data'!A2),".*\/(.*)"),regexreplace(to_text('Row Data'!A2),"\/.*",""),regexextract(regexextract(to_text('Row Data'!A2),"(.*)\/.*"),".*\/(.*)"))
Alternative:
=datevalue(regexreplace(to_text('Row Data'!A2),"(.|..)\/(.|..)\/(.*)","$2\/$1\/$3"))
Assuming you have US dates supplied in any of these formats:
M/D/YY
M/D/YYYY
MM/DD/YY
MM/DD/YYYY
M-D-YY
M-D-YYYY
MM-DD-YY
MM-DD-YYYY
M.D.YY
M.D.YYYY
MM.DD.YY
MM.DD.YYYY
To switch day with month, this will work relative to the example screengrab below:
=arrayformula(if(A1:A<>"", datevalue(regexreplace(to_text(A1:A),"(.|..)[\/\-\.](.|..)[\/\-\.](.*)","$2\/$1\/$3")),))

Related

How to i change the date time format on Google Sheets?

I am working on a datasheet on Google sheets and I am trying to change values in column (D) to date time format, so I went to Format<number<date time. But only a few values are getting converted and the rest remain the same. Please see below-
Screenshot of column D
The values aligned on right are converted and the left ones aren't. I even tried paint format, trim white spaces but it didnt work. Please suggest a way on how to resolve this error. Also, there are 49623 values in column D.
thank you
Your spreadsheet is set to a locale that uses the mm/dd/yyyy date format, while your data is using the dd/mm/yyyy date format. That means that the dates where the day of the month is less than or equal to 12 will get converted to dates incorrectly, and the rest of the data will remain as text strings.
To make it work, choose File > Settings > Locale and choose a locale that matches your data, then repaste the data to convert it correctly.
The "49623 values" are dateserials that can be converted to dates by formatting them in a date format. See this answer for an explanation of how date and time values work in spreadsheets.

Unable to use TO_DATE with multiple columns merging in Google Sheets

Prior question:
ArrayFormula displays dates improperly. How can I fix this?
Modified formula:
=ArrayFormula(TO_DATE(trim('Form Responses 1'!AG2:AG&" "&'Form Responses 1'!AH2:AH)))
The solution doesn't work when there are multiple columns merging. Any idea how to make this work?
=ARRAYFORMULA(TRIM(IF('Form Responses 1'!AG2:AG=0,"",TEXT('Form Responses 1'!AG2:AG,"mm/dd/yyyy HH:MM "))&'Form Responses 1'!AH2:AH))
Adjust the date time format as you like (check help on TEXT function)

Data Studio date range that filter on Google Sheet Column

I'm using Google Sheets, and wanted to do a Data Studio "real time" report, based on the data in the sheet.
The sheet contains data from an issue management program.
My data in the sheet exactly:
Issue type (string), Work time (number), issue created at (date), issue resolved at (date)
I successfully created a pie chart that's dimension is: Issue type and metric: Work time
I can see that all the data in the pie chart.
Now my problem is:
I can't filter this chart with a date range.
The date is in a correct format: YYYYMMDD
but I can't describe to data studio, which date column it should filter when I set a date range in the control.
Is it possible some way to create two date range filter and one of them filter on created date, and the other one filter on resolved at date?
Thank all of you!
Roland
Check to make sure that the date range you're filtering by is the first date column from the left in your Sheet. If it's not, then Data Studio gets confused and doesn't work properly.
I'm not sure if you can have two different dates in two different filters. The graphs wouldn't know which filter to follow.
Finally I deleted the connection between the sheet and the report, and started again everything, and it works fine. I think I created the connection when the date was not in a correct format, I changed it after making the connection.

Google Sheets Formula cannot get the date from another cell

I want to get the price of bitcoin on exact date.
The dates are written in Column A and they are updated regularly from a Google form
This is an example of the working formula, but the date in it is written manually (2017-01-31):
=ARRAYFORMULA(IF(ISBLANK($B$2:$B),"",CRYPTOFINANCE("BTC/USD", "price",2017-01-31)))
But when I try to get the dates from Column A, mentioned with $C$2:$C - Google sheets do not understand it
=ARRAYFORMULA(IF(ISBLANK($B$2:$B),"",CRYPTOFINANCE("BTC/USD", "price",$C$2:$C)))
Click here to check The spreadsheet
Thank you in advance!
"Doctor, it hurts when I do this."
In the example spreadsheet you are converting the dates into text for the column C, using the explicit TEXT() function. Then you are wondering why they no longer work as dates?
Stop converting to text.

How can I have Google Spreadsheet display all dates as MM/DD rather than MM/D?

I'm having some difficulty figuring out how to get Google Spreadsheet to always display date as MM/DD. Currently for the first 9 days of the month it displays MM/D (12/4) rather than MM/DD (12/04). There does not seem to be a option to set this under formatting. Thank you in advance!
Far from ideal, but if you date is in A1 then:
=month(A1)&"/"&if(day(A1)<10,"0"&day(A1),day(A1))
might serve.

Resources