Like Operator

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,835
Office Version
  1. 2019
  2. 2016
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

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).
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,214,826
Messages
6,121,797
Members
449,048
Latest member
greyangel23

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