Extracting text from a cell based on a rule

ks1987

New Member
Joined
Aug 8, 2012
Messages
24
Hi,

I have text in a cell, a portion of which I want to extract, the form of the text is as follows:

ABCD > EFGH (1234)

From this I need to extract EFGH, i.e. the text after after > and before (

Please note that the above is a generic example and I have a lot of cells with different values for ABCD, EFGH and 1234.

Looking forward to getting some answers on this.

Thanks
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I am amazed by the elegance of your formula. I am interested in how you approached this problem and how you found a solution to it. Would you care to outline the same please?

Thanks
 
Upvote 0
MID(cell,S,L) extracts the text starting at S and with length L.

FIND(">",A1)+2 finds the location of > and adds 2 to it so we start at the right place.

FIND("(",A1)-FIND(">",A1)-3 finds the length between > and (, subtracting 3 to account for spaces.
 
Upvote 0
I know that problem is solved, but I have another way:

Code:
=TRIM(MID(REPLACE(A1,FIND("(",A1),999,""),FIND(">",A1)+1,999))

Markmzz
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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