Extracting text

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,601
Office Version
  1. 2021
Platform
  1. Windows
I have the following text

Castle 159-71 Court

I want extract the text Castle as well as Court i.e. 4 characters before the - and 3 characters after the dash

I have used the following formula by cannot get it to work

=LEFT(A17,FIND("-",A17)-4),TRIM((RIGHT(A17,FIND("-",A17)-5))

Your assistance will be most appreciated
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try this:

=LEFT(A17,FIND("-",A17)-4)&TRIM(RIGHT(A17,FIND("-",A17)-5))

You used a comma to catenate when it should have been an & and you had messed up parens.
 
Upvote 0
I have the following text

Castle 159-71 Court

I want extract the text Castle as well as Court i.e. 4 characters before the - and 3 characters after the dash

I have used the following formula by cannot get it to work

=LEFT(A17,FIND("-",A17)-4),TRIM((RIGHT(A17,FIND("-",A17)-5))

Your assistance will be most appreciated
You can use:
Code:
=LEFT(D1,FIND("-",D1,1)-4)&" "&RIGHT(D1,LEN(D1)-FIND("-",D1)-3)
to get "Castle Court" as result.
 
Upvote 0
Try:
=LEFT(A1,FIND("-",A1)-4)
and
=TRIM(MID(A1,FIND("-",A1)+3,LEN(A1)))
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,767
Members
452,940
Latest member
rootytrip

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