Converting text to date format YYQQ - excel

I am storing project start and finish dates in the text format YYQQ. My goal is to convert this text to an actual date format, as to be able to substract finish and start dates to obtain the duration of a project in number of quarters.
For example if a project started in the third quarter of 2015, 15Q3 and finished in the second quarter of 2016, 16Q2, then it took 3 quarters to complete the project.
The excel function DATE requires text to be converted to the format YYMMDD, which is not what I want. Does excel have a function to convert for example text 16Q2 to date YYQQ format?

Excel does not have that function. But you can easily write a formula to do that conversion:
To convert to a normal excel date:
=DATE(LEFT(Start,2)+2000,(RIGHT(Start,1)-1)*3,1)
will return the starting date of the quarter.
For a date close to the middle of the quarter, something like:
=DATE(LEFT(Start,2)+2000,(RIGHT(Start,1)-1)*3,45)

Related

What is the shortest formula in excel to covert text date format e.g. 17 Jan, 2023 into regular date format like 1/17/2023?

I have sales data where transaction date is mentioned as text like 17 Jan,2023. I want to extract month name using TEXT(A1,"MMM") or MONTH(A1) function however these two functions does not work with text date format.
I have tried multiple formulas to convert text date format to normal date format but I didn't get the right answer or the optimized small function or formula.
Later, I tried the following formula but it is too long and complex to use.
=DATE(RIGHT(A1,4),MATCH(MID(A1,1,3),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0)-1+1,DAY(LEFT(A1,FIND(",",A1)-1)))
My question is that if anybody knows are shortest way to do the same?
In an English-language locale, the VALUE() function will recognise 17 Jan 2023 as a valid date (although you will have to render the date format manually), so the SUBSTITUTE() function can be used to remove the , that appear in your text, and then nesting this in the VALUE() function should return an Excel-recognised date, i.e.
=VALUE(SUBSTITUTE(A1,","," "))

Excel - Convert JavaScript/Unix timestamp to date

I'm wondering how to convert a timestamp to a date in Excel.
JavaScript timestamp:
1486812409161
Unix timestamp
1486812409
What Excel function / formula can convert to something like:
2/11/2017 11:26 AM (or any human readable date)
I did see this answer, but I can't get this to work for me (on Mac OS X / Excel 2011).
When I create a new cell and set it's value to the following formula:
= (MsValueCellReference / 86400000) + DATE(1970,1,1)
The result is: 41315.47696
I am using the current formula =(<javascriptTimestamp>)/(1000*60*60*24)+25569 and then formatting the cell with dd/mm/yyyy hh:mm:ss.
To explain the terms in the formula, the Javascript timestamp has milliseconds which accounts for the 1000. There are 60*60*24 seconds in one day.
Finally, Excel dates start on Jan 1 1900, and Javascript starts on Jan 1 1970. There are 25569 days between Jan 1 1900 and Jan 1 1970.
Excel is pretty happy to interconvert between dates and numbers, as you noticed. However, afaict, it can't always guess correctly which of the two you want to see.
So, to ensure that a value is rendered as a date, you'd need to open the Format Cells dialog, go to the first tab Number, and set the cell's format Category to one of the Date types.

How to convert a String date to a Date

How can I convert this string:
Tue Jan 24 14:59:20 BRT 2017.
Into a date that includes day month year and time and timezone, using Excel functions only.
I have several cells with dates following this format. I have to compute the difference between some of these dates in minutes. I believe that the first step is converting the date to a String to a real date information. Then, I will be able to: order the dates and compute the time between consecutive dates.
Use this formula:
=--(SUBSTITUTE(MID(A1,5,LEN(A1)),"BRT",""))
Then format it to the format you want.
It will now work in math equations.

Timestamp line to a excel readable timestamp

I have thousands of timestamps in the form shown:
Sun Jul 02 06:00:02 2017 (GMT-04:00)
With Date, Day, and Time all varying. This is a military time stamp ( ie each day counts up to 24 hours)
I have used the following formula to get just the time. But it's not readable by excel.
=MID($A2,FIND(":",$A2)-2,8)
This results in a value like:
06:00:02
However, this does not help and I have to do much manipulation. I want excel to recognize the date and time so i have a true timeline on my x-axis.
I'd like to get it in the form of
7/2/2017 6:00:02 AM
This way I can have a graph that appears like the following:
Graph Example with desired timeline on x axis
Cheers!!!!
Since the weekday and the month are all in three letter abbreviations, you can use the Mid function with an absolute position to extract elements of the date. For just the date you could use
=DATEVALUE(MID(A1,9,2)&"-"&MID(A1,5,3)&"-"&MID(A1,21,4))
For just the time value, you could use
=TIMEVALUE(MID(A1,12,8))
To get the date and time in one value, just add the two and format as you want to see it.
=DATEVALUE(MID(A1,9,2)&"-"&MID(A1,5,3)&"-"&MID(A1,21,4))+TIMEVALUE(MID(A1,12,8))

Cannot convert serial number to date and time format

It's just as the title says, I cannot convert the serial numbers generated from the DATE and TIME function to a Date and Time Format.
I have this date: 27/11/2012 1:09 PM (originally typed in as text and not acknowledged as date and time, because it was aligned to the left). So instead, I decided to use the DATE and TIME function like so:
=(DATE(2014,8,26) & TIME(13,27,0))
It resulted with a serial number. So I googled on ways how to convert the serial number to a date format. OF course, I already tried formatting a cell by right-clicking it and selecting the Date category but still no luck.
Now that I think about it, is the formula above alright? I mean is it okay to use date and time in one cell? By the way, the dates and times were manually typed in in one cell. And I do not have an option to segregate each date and time elements per cell.
UPDATE: So I tried doing it with just the DATE function only and the formatting worked. Is there any way that even the time is included?
=(DATE(2014,8,26) + TIME(13,27,0))
Use "+" for date and time concord-nation :)

Resources