Removing everything outside brackets in a cell

justin_n84

Board Regular
Joined
Jan 29, 2017
Messages
59
Hi!!

I have a bunch of cells which contain data similar to "[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]0.120 (3.048)". I want to delete everything out side the brackets. Is there an easy way to do this?

Thanks in advance
[/FONT]
 
OK sounds like youre going my route with 2 replaces. For the first replace you want to replace anything followed by an open bracket with just an open bracket. This is done by entering *( in the search box and ( in the replace box. For the second search, type )* in the search box and ) in the replace box. I have highlighted the exact text to use in red.
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
For those interested, here is a simple formula solution...

=-REPLACE(C1,1,FIND("(",C1)-1,"")
 
Upvote 0
Very good Rick !

It looks like that works because Excel is able to interpret the entry
(3.048)
as a number, not a text string, especially when encouraged to do so by use of the - symbol at the front.

So this approach does not work in a slightly different scenario, such as
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl63, width: 64"]0.120[3.048]
or
0.120X3.048X[/TD]
[/TR]
</tbody>[/TABLE]

Edit to add - don't know why my post has this box around the last couple of lines - wasn't intended by me and now don't know how to get rid of it :-)
 
Last edited:
Upvote 0
It looks like that works because Excel is able to interpret the entry
(3.048)
as a number, not a text string, especially when encouraged to do so by use of the - symbol at the front.
One of the ways Excel can display negative numbers is when the number is enclosed in parentheses, so I used the REPLACE function to create that text string... if a numerical text string is involved in a mathematical expression, Excel will convert the text number to a real number in order to complete the mathematical operation. Placing a minus sign in front of a number is the same as multiplying that number by minus one which is a mathematical operation. So, in combination, my formula is multiplying a negative text number by minus one... the negative text number becomes a real negative number in order to complete the operation of multiplying it by minus one... and a minus number times a minus number produces a positive result (the product of the two values being multiplied).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
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