I have general formatting coming across as 'Sep 30 2021'. How can I easily convert this to read 2021-09-01? I have attempted to do so the normal routes but it appears I need a formula to solve this issue. Any and all help is appreciated.
Generally you can do this by =Text(Column, "yyyy-mm-dd")
Related
I Have an excel file with blood sample results (i.e. Insuline and Glycemia).
The problem is that there are some cells on that excel file that have a wrong format, they have the insulin results as a personalized date format (d.m), therefore the result looks like 18.3 (which is reasonable) but when I try to read the file in R, it looks like a numeric date = 44273 (March 18th, 2021).
I've been trying to fix it at the excel file, but I haven't been able to do it. Does anybody has an idea of how to fix this problem?
Best Regards!
you could use package readxl and use the col_types argument to read in the column as numeric. Below would be reading 4th column as numeric:
library(readxl)
read_excel("blood_sample.xlsx", col_types = c("logical", "skip", "guess", "numeric"))
Read more here: https://readxl.tidyverse.org/articles/cell-and-column-types.html
I have a text value that looks like this: 2019-03-25T06:05:00-07:00. The general format is yyyy-mm-ddThh:mm:ss-GMT. I don't care about the GMT part. I am trying to use this text field to make time series scatter plots in excel.
I want to convert it to a timestamp as simply as possible. I currently do this using a bunch of formulas:
Input: 2019-03-25T06:05:00-07:00
Extract parts of time individually: =value(mid(input_cell,12,2))
Use date() and time() to get timestamp types
Add them together per this answer: https://stackoverflow.com/a/41164517/11163122
Use custom formatting to get a timestamp value
Output: 3/25/2019 6:05:00 AM
In total this took me 8 cells and custom formatting. This is too complicated. What is a simpler/more elegant way to do this?
You can use:
=--REPLACE(LEFT(A1,19),11,1," ")
and format as desired
Turns out the timestamp type is ISO 8601: https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
This led me to this answer: https://stackoverflow.com/a/26315881/11163122
Using the formula there, I found this to be a sufficient solution. If anyone out there has a better method, please speak up! :)
I am looking for a non-ugly way to convert a MUMPS formatted $H ("63868,62327" is 11/12/2015 at 17:18:47) date/time into an Excel 2016 compatible format date/time format. I came up with the following, but it's ugly:
=NUMBERVALUE(NUMBERVALUE(LEFT(A1,(SEARCH(",",A1)-1))-21548) & MID(NUMBERVALUE((1/86400)*MID(A1,(SEARCH(",",A1)+1),5)),2,6))
While this does work, it is definitely ugly. Any ideas?
How about:
=LEFT(A1,FIND(",",A1)-1)-21548+ MID(A1,FIND(",",A1)+1,99)/86400
Just curious to know if you are able to use $zdt($h) instead of $h on the Caché side. This will do that exact same conversion for you.
Furthermore, if this is a solution, then there are extra parameters to specify the format. The one you asked about is the default: $zdt($h,1,1) or simply $zdt($h).
$zdt has date formats between 1-15 and time formats between 1-10.
This format is as follows:
$zdt([n],[d],[t])
Where n is a mumps formatted number, d is the date format 1-15 and t is the time format 1-10.
I needed help as I am trouble with this recurring problem.
I have following date formats. American date format:
8/30/2013
11/1/2014
1/12/2014
For 8/30/2013 , I write =DATE(RIGHT(B2;4);LEFT(B2;1);MID(B2;3;2)), and I get it as "2013-08-30". For the other dates, I have to manually rewrite them again and again.
How can I write in one line to get 8/30/2013 or 10/12/2014 in a final date result like "2013-xx-xx?
if all entries are dates, you can use Text function:
=TEXT(B2, "yyy-mm-dd")
hope this helps.
Since you used string manipulation formulas and it worked for your first date, I believe that the date is actually text format.
As such, I would suggest using FIND to get the positions of / like this:
=DATE(RIGHT(B2;4);LEFT(B2;FIND("/";B2)-1);MID(B2;FIND("/";B2)+1;FIND("/";B2;FIND("/";B2)+1)-FIND("/";B2)-1))
It's quite long, I admit, but it's quite difficult to get substrings between two specific characters. If the year is always in that format, then you can use a slightly shorter formula:
=DATE(RIGHT(B2;4);LEFT(B2;FIND("/";B2)-1);MID(B2;FIND("/";B2)+1;LEN(B2)-5-FIND("/";B2)))
I am currently trying to convert yyyymmdd type of date to a ddmmyyy format.
I've tried using DATE function and something like this:
=DATE(LEFT(A3;4);MID(A3;5;3);RIGHT(A3;7))
Original date for this function is 20120401 but the formula returns: 16.12.2104.
I've tried using functions YEAR, MONTH and DAY instead of LEFT, MID and RIGHT but that's not the right way.
I also tried using DATEVALUE but since Excel probably doesn't recognize yyyymmdd as a date, it gives me a #VALUE! error.
I've found a couple of solutions for SQL but it isn't my strong side yet - and this should be achievable easily in Excel.
Is there a way to do this in Excel?
Applying =DATE(LEFT(A3;4);MID(A3;5;3);RIGHT(A3;7)) to 20120401 in A3 is effectively to reassemble the component characters as below on the left:
These effectively become converted as on the right.
The solution was simply to exclude the digits highlighted red with:
=DATE(LEFT(A3;4);MID(A3;5;2);RIGHT(A3;2))
but the locale might have been a factor and when dealing with date serial numbers and/or what appears to be a date but is a string various other issues might have been involved.
Consider:
=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))