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:
XXXXabc(XXXX)
XXXXabcd
XXXXabcde(XXXXXX)

<tbody>
</tbody>

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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Also
Code:
=MID(A2,5,(FIND("(",A2))-5)
 
Upvote 0
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
1XXXXabc(XXXX)abc
2XXXXabcdabcd
3XXXXabcde(XXXXXX)abcde

<colgroup><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet96

Worksheet Formulas
CellFormula
B1=MID(A1,5,(FIND("(",A1&"("))-5)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
Good catch @jtakw, without the &"(" it would error when no "(" is in the search string.
 
Upvote 0

Forum statistics

Threads
1,215,756
Messages
6,126,689
Members
449,329
Latest member
tommyarra

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