Extract Dates

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,566
Office Version
  1. 2021
Platform
  1. Windows
I have text below and am trying to extract the first date in B3 i.e 15 June 2015 and the second date in C3 i.e . 20 June 2015

It would be appreciated if someone could kindly assist me




Excel 2012
AB
3David Martins - CT-BKT return 15 June 2015 - 20 June 2015June 2015 - 20 June 2015
Sheet1
Cell Formulas
RangeFormula
B3=RIGHT(A3,FIND("return",A3))
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Thanks for the help. It is extracting 15 June 2015 - 20 June 2015 -see below


Excel 2012
AB
3David Martins - CT-BKT return 15 June 2015 - 20 June 201515 June 2015 - 20 June 2015
Sheet1
Cell Formulas
RangeFormula
B3=RIGHT(A3,LEN(A3)-FIND("return",A3)-6)


I have manually shown what result should in Col B & C below. Kindly amend your formula so as to compute the correct result


Excel 2012
ABC
5David Martins - CT-BKT return 15 June 2015 - 20 June 201515-Jun-1520-Jun-15
Sheet1
 
Upvote 0
I have put the values in C and D

Cell B1 contains the formula
Code:
=TRIM(MID(A1,FIND("RETURN",UPPER(A1))+6,555))

Cell C1 contains the formula
Code:
=DATEVALUE(TRIM(LEFT(B1,FIND(" - ",B1))))

Cell D1 contains the formula
Code:
=DATEVALUE(TRIM(MID(B1,FIND(" - ",B1)+2,555)))

... which means that C1 and D1 contain a number. Go format that as you please to make it look like a date. Or use the values. Your call.


Thanks for the help. It is extracting 15 June 2015 - 20 June 2015 -see below
Excel 2012
AB
3David Martins - CT-BKT return 15 June 2015 - 20 June 201515 June 2015 - 20 June 2015

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1




 
Upvote 0
In B3 enter:

=TRIM(LEFT(D3,FIND("-",D3)-1))

In C3 enter:

=TRIM(REPLACE(D3,1,FIND("-",D3),""))

In D3 enter:

=TRIM(REPLACE(A3,1,SEARCH("return",A3)+5,""))

Note. Calling FIND to locate "return" is risky: SEARCH is the right function to call upon.
 
Upvote 0
Maybe……..

In B3, formula copy across to C3 :

=TRIM(MID(SUBSTITUTE(" - "&MID($A3,SEARCH("return",$A3)+7,99)," - ",REPT(" ",50)),COLUMNS($A3:A3)*50,50))

Regards
 
Upvote 0

Book1
ABC
1David Martins - CT-BKT return 15 June 2015 - 20 June 201515 June 201520 June 2015
Sheet1
Cell Formulas
RangeFormula
B1=LEFT(RIGHT(A1,LEN(A1)-FIND("return",A1)-6),FIND("-",RIGHT(A1,LEN(A1)-FIND("return",A1)-6))-2)
C1=RIGHT(RIGHT(A1,LEN(A1)-FIND("return",A1)-6),LEN(RIGHT(A1,LEN(A1)-FIND("return",A1)-6))-FIND("-",RIGHT(A1,LEN(A1)-FIND("return",A1)-6)))


Is this correct?
 
Upvote 0
Thanks Guys for all the help, much appreciated
 
Upvote 0
Note. Calling FIND to locate "return" is risky: SEARCH is the right function to call upon.

Almost agree. Personally, I am not a fan of anything where I cannot control wildcards. I'm having a really bad time with users entering
"*** STANDBYE" or something similar when they want the text to stand out. Those asterisks mess up LOOKUP bigtime.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,102
Members
449,205
Latest member
ralemanygarcia

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