Like Operator

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,072
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Is there any way I can use Like to determine if a string starts with "[" and ends with "]"?

Or another (better?) method than left,1 and right, 1 ?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Maybe...

Like "[[]*[]]"
You can do it like this as well...

Like "[[]*]"

The left square bracket needs to be included inside of a the square bracket pair... the right square bracket can be used directly in the pattern string as above.
 
Upvote 0
Even better. Thanks Rick. I nearly fluked this as I'd tried all sorts of similar things, but went wrong looking for a single escape char.
 
Upvote 0
You can do it like this as well...

Like "[[]*]"

The left square bracket needs to be included inside of a the square bracket pair... the right square bracket can be used directly in the pattern string as above.


Curious. I did not know it was possible :cool:
Thanks for sharing.

M.
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
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