MID Function to find a string within brackets

Peteor

Board Regular
Joined
Mar 16, 2018
Messages
152
Hello I am using the following:

=MID(B5,SEARCH("[",B5)+1,SEARCH("]",B5)-SEARCH("[",B5)-1)+0

Where cell B5 has the following contents:
=IF(B6="","rdhgxfjhsftjhjh(Text to extract)hujkfjkdjsdt","")

and cell B6 is blank.

I am receiving a #Value error, and am unsure why. My cells are formatted to Category "General".

I am trying to look at a specific cell (in excel, not VBA) where my "Text to extract" will be part of a formula and within brackets. Does anyone have any ideas?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Couple of things
1) your text string has brackets (), whilst your formula is looking for braces [].
2) You are trying to add 0 to a text string, which cannot work.
 
Upvote 0
I see. Part of this was my mistake. I edited the formula I listed here to have the braces, and forget to edit the contents of B5. Both B5 and my formula have Braces on the Excel file, and are still returning the #Value error.

Fluff - Thank you! I removed to + 0 and it extracted my string. Problem solved! Thank you everyone.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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