How to erase parts of a string of text

gcefaloni

Board Regular
Joined
Mar 15, 2016
Messages
119
Hi,

I have thousands of strings of text like this one in an excel sheet (Pembina Pipeline Corp. 3.54% 02-03-2025 Callable MTN) and what I would like to do is to build a formula that goes through those strings and remove all text to the right of the year in those strings. All strings have 3 important sets of information: The company name, the coupon rate (%) and the maturity of the bond (the date). Those 3 things are the only thing I would like to extract and the rest I would erase.

How would you go about removing the "Callable MTN" portion of that string so that the rightmost portion of every string is always the maturity date?

Thanks in advance for your help! It will be extremely appreciated!
 
=IFERROR(DATE(RIGHT(TRIM(MID(A2,FIND("%",A2)+2,10)),4),LEFT(TRIM(MID(A2,FIND("%",A2)+2,10)),2),MID(TRIM(MID(A2,FIND("%",A2)+2,10)),4,2)),"") was the answer.

The text string wasn't in the same format as my system date so it didn't recognize it as a date and therefore Value or Datevalue functions weren't working.
Hard to tell with dates like the sample whether 2 March or 3 Februaey but from your formula I'm guessing that the text is in m-d-y format and you want d-m-y. If so, you could also try this bit shorter one (add IFERROR if required).

Excel Workbook
ABCD
1TextCoRateMaturity
2Pembina Pipeline Corp. 3.54% 02-23-2025 Callable MTNPembina Pipeline Corp.3.54%23-02-2025
3ABC Inc 10.00% 05-06-2025 WhateverABC Inc10.00%06-05-2025
Extract Info (3)
 
Last edited:
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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