Transform text-date in format - excel

I have a text formatted date that looks like this:
June 12th 2017, 9:07am PDT
How can I transform it in a date format (the classic methods Format Cells and DateValue() don't work)?
Thank you.

My solution uses a helper table listing all the 12 months and their serial number at A1:B12
January 1
February 2
March 3
April 4
May 5
June 6
July 7
August 8
September 9
October 10
November 11
December 12
Assuming the value is in D10
Getting the separate elements
Month:
=VLOOKUP(LEFT(D10,FIND(" ",D10)-1),A1:B12,2,FALSE)
Date:
=IFERROR(VALUE(RIGHT(LEFT(D10,FIND(" ",D10)+2),2)),RIGHT(LEFT(D10,FIND(" ",D10)+1),1))
Year:
=RIGHT(LEFT(D10,FIND(",",D10)-1),4)
Hour:
=IF(RIGHT(LEFT(D10,FIND(":",D10)+4),2)="am",RIGHT(LEFT(D10,FIND(":",D10)-1),2),RIGHT(LEFT(D10,FIND(":",D10)-1),2)+12)
Minute:
=RIGHT(LEFT(D10,FIND(":",D10)+2),2)
All this combined in the DATE and TIME function to give a single formula:
=DATE(RIGHT(LEFT(D10,FIND(",",D10)-1),4),VLOOKUP(LEFT(D10,FIND(" ",D10)-1),A1:B12,2,FALSE),IFERROR(VALUE(RIGHT(LEFT(D10,FIND(" ",D10)+2),2)),RIGHT(LEFT(D10,FIND(" ",D10)+1),1)))+TIME(IF(RIGHT(LEFT(D10,FIND(":",D10)+4),2)="am",RIGHT(LEFT(D10,FIND(":",D10)-1),2),RIGHT(LEFT(D10,FIND(":",D10)-1),2)+12),RIGHT(LEFT(D10,FIND(":",D10)+2),2),0)
Then change the format of the cell to:
mmmm dd yyyy hh:mm AM/PM "PDT"
This will give:
June 12 2017 09:07 AM PDT
To add a comma(,), use the custom format:
mmmm dd yyyy"," hh:mm AM/PM "PDT"

Related

Excel: calculate which occurance of a weekday, within the month, from any given date e.g. fifth Friday

I am not very good at Excel. In the NHS (UK) we often schedule activity by looking at the columns on a calendar (e.g. All day theatre list Mondays week 1,3,5). This means on the first Monday, third Monday and if present fifth Monday. Using a printed calendar you can see the columns, for example Mondays in Jan 2023 where there are five.
When planning, it would be great to have a formula that would accept a date, and return the ordinal of the weekday for that month e.g.
Jan 02 2023 = 1
Jan 28 2023 = 4
Jan 29 2023 = 5
Jan 30 2023 = 5
I have searched and found the WEEKNUM function, but this counts rows on the calendar not giving the result I need.
Any help gratefully received
Kind Regards Gavin Holt
This should return those values:
=-INT(-(DAY(YourCellWithTheDate))/7)

Converting integer to time format in excel

Date
19112018
19112016
19112015
19112013
I have a column named Date.
I want to convert 19112018 to 2019-11-20 18:00
19 means year 2019
11 month
20 days
18 is hour
Thanks .
Use the following formula:
=DATE(20&LEFT(A2,2),MID(A2,3,2),MID(A2,5,2))+RIGHT(A2,2)/24
Or:
=--(20&REPLACE(REPLACE(REPLACE(A2,7,0," "),5,0,"-"),3,0,"-")&":00")
Then format the output cell:
yyyy-mm-dd hh:mm

Excel add hours to date excluding weekends and holidays

I would like to add hours on a start date and skip weekends and holidays in an Excel file.
The hours would be 24, 36 and 48.
So if the start date and time are 4 Mar 2019, 13:42, the end date and time should be :
24 hours: 5 Mar 2019, 13:42
36 hours: 6 Mar 2019, 01:42
48 hours: 6 Mar, 2019, 13:42
I am now using this formula:
=WORKDAY(E2,G2/24,Holidays!$A$2:$A$18)+MOD(E2,1)
E2 is the start date and time in mm/dd/yy hh:mm format, G2 is the number of hours, Holidays!$A$2:$A$18 is the range of holiday.
This formula works totally fine for 24 hours and 48 hours, however, it is not working for 36 hours. It would be much appreciated if someone would help me to solve this problem.
Construct a simple date from addition and then convert it to the workday.
=WORKDAY(A2+B2/24-1, 1, Holidays!$A$2:$A$18)+MOD(A2+B2/24, 1)

Find the end-of-month date from any date entered in MS Excel

I need to take the date from one cell, find the end of the month that that date falls into, then add one calendar month.
Example:
Enter jan 13: jan 13 end of month is Jan 31, + 1 month is Feb 28 (or 9 on leap year).
Feb 19: = March 31
March 2 = 30 April
March 30 = 30 April
March 31 = 30 April
etc etc
Is there an excel formula that will do this? I don't want any macro/ VBA stuff.
If you have 2007 or later than:
=EOMONTH("3/30/2016",1)
Use the Date function, add one to the month and set the Day to zero. This gives the last day of the month. To get the last day of the next month add two to the month.
=DATE(YEAR(E3),MONTH(E3)+1,0)
=DATE(YEAR(E3),MONTH(E3)+2,0)

How do i add year (date) criteria to DSUM?

I have a database that looks like this:
(A1)Client (B1) Date (C1) debts
(A2)1 (B2) Mon 2 november 2008 (C2) 1500$
(A3)2 (B3) Thu 7 february 2008 (C3) 1000$
(A4)3 (B4) Sat 28 March 2009 (C4) 800$
(A5)4 (B5) Mon 16 March 2009 (C5) 1200$
The date format is 24/11/2008.
I have to use DSUM to get the sum of the debts clients had in 2008.
I already did a table that looks like this:
(A7)Client (A7) Date (C7) debts
(A9) 2008
and the function =DSUM(A1:C5,3,A7:C8) but it seems I can't extract the value of 2008 from the date 24/11/2008.
It is generally not a good idea to store dates as text, change your 2008 to 1/1/2008 and format as "YYYY"
To use DSUM to sum entries that fall in a calendar year you will have to define the start and end date, so your filter data will look like this:
Client Date Date
debts =">=1/1/2008" ="<1/1/2009"

Resources