Extract Date as Text

How_Do_I

Well-known Member
Joined
Oct 23, 2009
Messages
1,843
Office Version
  1. 2010
Platform
  1. Windows
How would I extract June 1918 from the following as text please?

Excel Workbook
A
8June 1918 Moved to Dublin.
Sheet1
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Thanks Jeff and Treta. I used Treta's formula with some other formulas I had as I hadn't seen your solution Jeff. A lot of my data for dates are in this format 01.07.1916 but I need to convert that to 01-Jul-16. So I needed a formula to find a dot before the first space. I notice your solution above Jeff gives an error to the day.month.year date format that some of my data is in so I'm sure I can improve the following formula now...

Excel Workbook
CDEFG
11OLDTretaNEW
12 Sep 1914Sep 1914Sep 1914 Formed
13May 1917May 1917May 1917 Moved
1408-Oct-191708.10.1917 Moved08-Oct-191708.10.1917 Moved
15Mar 1918Mar 1918Mar 1918 Disbanded.
Sheet1
 
Upvote 0
=IFERROR(TRIM(LEFT(G12,FIND("@",SUBSTITUTE(G12," ","@",2)))),TEXT(SUBSTITUTE(TRIM(SUBSTITUTE(CONCATENATE(MID(G12,1,10),"."),"."," "))," ","-"),"dd-mmm-yyyy")+0)
 
Upvote 0
...A lot of my data for dates are in this format 01.07.1916 but I need to convert that to 01-Jul-16.

Are those actual (real) dates, or just "values" embedded in a text string?

If they are real dates, you wont "find" the dot, it does not exist - it is just formatting used by excel.
 
Upvote 0
As an alternative to your new formulas from Posts # 5 and # 6:

=IF(MID(REPLACE(TRIM(G12),4,2,""),3,2)="..",TEXT(MID(TRIM(G12),7,4)&"-"&MID(TRIM(G12),4,2)&"-"&LEFT(TRIM(G12),2),"dd-mmm-yyyy"),TRIM(LEFT(SUBSTITUTE(TRIM(G12)," ",REPT(" ",99),2),99)))

If you are sure there are no occasional double spaces and leading spaces in your strings, here is a lighter version:

=IF(MID(REPLACE(G12,4,2,""),3,2)="..",TEXT(MID(G12,7,4)&"-"&MID(G12,4,2)&"-"&LEFT(G12,2),"dd-mmm-yyyy"),TRIM(LEFT(SUBSTITUTE(G12," ",REPT(" ",99),2),99)))
 
Upvote 0
Could you ever have a day when you have the month/yr combo?
1 Sep 2017
or just
Sep 2017
?
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,215
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top