Finding symbols within text in a cell ???

sobeitjedi

Board Regular
Joined
Mar 13, 2006
Messages
235
Office Version
  1. 365
Hi.

Column A, cells 1 to 4 has text like:

A1 = "c:\file1.txt"
A2 = "c:\file2$.txt"
A3 = "c:\file7+.txt"
A4 = "c:\file12.txt"

Ideally, what I would like is for the cell to be highlighted (conditional formatting?) if the cell contains any + or $ or % or { or &, etc - so in the example above, A2 and A3 would be highlighted because they contain one or more of those symbols, A1 and A4 would remain untouched.

Any suggestions?
 

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).

ParamRay

Well-known Member
Joined
Aug 6, 2014
Messages
1,195
.
.

Select your 4 cells and then create a conditional formatting rule with this formula:

=OR(ISNUMBER(SEARCH("+",A1)),ISNUMBER(SEARCH("$",A1)),ISNUMBER(SEARCH("%",A1)),ISNUMBER(SEARCH("{",A1)),ISNUMBER(SEARCH("&",A1)))
 
Upvote 0

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,426
Office Version
  1. 2019
I think the OP is looking for other characters as well as he states "etc"
What youve done is what I started to do, then noticed the "etc" at which point I gave up solving this since the OP has not clearly specified what characters he wishes to search for.
 
Upvote 0

sobeitjedi

Board Regular
Joined
Mar 13, 2006
Messages
235
Office Version
  1. 365
The characters I wish to highlight are:

Tilde
Number sign
Percent
Ampersand
Asterisk
Braces
Backslash
Colon
Angle brackets
Question mark
Slash
Pipe
Quotation mark
 
Upvote 0

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,905
Office Version
  1. 365
Platform
  1. Windows
Hi, create a list of your special characters and name the range "SYMBOLS" - note, you will need to escape any wild card characters with the tilde (~) character (see rows 1, 6 and 13 in the example table)

And then use:
=SUMPRODUCT(COUNTIF(A1,"*"&SYMBOLS&"*"))>0

Excel Workbook
H
1~~
2+
3-
4%
5&
6~*
7{
8}
9\
10:
11[
12]
13~?
14\
15|
16"
17/
Sheet1
 
  • Like
Reactions: shg
Upvote 0

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,836
Office Version
  1. 2010
Platform
  1. Windows
Any file path is going to have a colon and a backslash, no?
 
Upvote 0

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,905
Office Version
  1. 365
Platform
  1. Windows
None of these suggestions work so far - anyone else care to try?

You'll need to expand on "does not work" if you want to progress with my suggestion; i.e. post the list of symbols and a list of values that either didn't highlight when they should have have, or did highlight when they should not have.
 
Upvote 0

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,836
Office Version
  1. 2010
Platform
  1. Windows
I think FormR's suggestion was great. If you want to limit it to valid characters for filenames,

A​
B​
C​
D​
E​
1​
file1.txt
TRUE​
B1: =SUMPRODUCT(COUNTIF(A1, "*" & Symbols & "*")) = 0
Symbols​
2​
file2$.txt
TRUE​
"​
3​
file7+.txt
TRUE​
~*​
4​
file*.txt
FALSE​
/​
5​
\​
6​
:​
7​
<​
8​
>​
9​
~?​
10​
|​

The only thing I changed was the symbols and the comparison operator.
 
Upvote 0

Forum statistics

Threads
1,191,196
Messages
5,985,227
Members
439,950
Latest member
Xearo96

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
Top