Text Block Dates

aaronxv

New Member
Joined
Nov 5, 2010
Messages
11
Hi all,

I have a block of text in a cell, this block will contain 1 or more dates. They may be formatted as January 2017 or 01/01/2017. I would like to write a formula to replace the first style with JAN2017 and the second style 01JAN2017. I am trying to work out a way to do it combining substitute/find, but so far can't figure out the syntax.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Here is one way to get the output you asked for...

=TEXT(A1,CHOOSE(RIGHT(CELL("format",A1))-2,"ddmmmyyyy","mmmyyyy"))

but note that the output from this formula is no longer a date, rather, it is purely text.
 
Upvote 0
I tried this, but it gives me a #VALUE error.

To clarify, I will have a cell that contains:

"Random text and information etc, etc, etc, 09/26/2017 more text more text August 2017 more text"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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