Formula to Remove first 4 characters of cell and if parenthesis are present remove them + data inside as well

duanec

New Member
Joined
Jun 20, 2018
Messages
1
Receiving data as:
[TABLE="width: 500"]
<tbody>[TR]
[TD]XXXXabc(XXXX)[/TD]
[/TR]
[TR]
[TD]XXXXabcd[/TD]
[/TR]
[TR]
[TD]XXXXabcde(XXXXXX)[/TD]
[/TR]
</tbody>[/TABLE]

I need a formula that removes the first 4 characters and removes parenthesis(and data within) IF they appear at the end.

I started with... =MID(A2,5,FIND("(",A2,1)-5) which behaves fine for cells with parenthesis but shows #VALUE ! for cells without parenthesis.

Thoughts?
 

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
Hi,

I think JLGWhiz means this:


Book1
AB
1XXXXabc(XXXX)abc
2XXXXabcdabcd
3XXXXabcde(XXXXXX)abcde
Sheet96
Cell Formulas
RangeFormula
B1=MID(A1,5,(FIND("(",A1&"("))-5)
 
Upvote 0
Hi,

I think JLGWhiz means this:

AB
XXXXabc(XXXX)abc
XXXXabcdabcd
XXXXabcde(XXXXXX)abcde

<colgroup><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

</tbody>
Sheet96

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B1[/TH]
[TD="align: left"]=MID(A1,5,(FIND("(",A1&"("))-5)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Good catch @jtakw, without the &"(" it would error when no "(" is in the search string.
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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