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?
 
Or, to embed the symbols in the formula,

=SUMPRODUCT(COUNTIF(A1, "*" & {"""";"~*";"/";"\";":";"<";">";"~?";"|"} & "*")) = 0
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I prefer this method, but every cell comes back as TRUE, whether it contains a symbol or not
 
Upvote 0
How about the example on row 4?
 
Upvote 0
Please post an example that returns TRUE when it should be FALSE..

One of my rows in column A19 contains the text:
RA1 Expenditure.xlsx

B2 where I've put the formula:
=SUMPRODUCT(COUNTIF(A19, "*" & {"""";"~*";"/";"\";":";"<";">";"~?";"|"} & "*")) = 0


returns TRUE
 
Upvote 0
That means it's a valid filename.
 
Upvote 0
If you want it the other way, switch the comparison operator back to ">"

=SUMPRODUCT(COUNTIF(A19, "*" & {"""";"~*";"/";"\";":";"<";">";"~?";"|"} & "*")) > 0

But that doesn't explain how you are getting a TRUE result for "all" of your values.
 
Last edited:
Upvote 0
One of my rows in column A19 contains the text:
RA1 Expenditure.xlsx

B2 where I've put the formula:
=SUMPRODUCT(COUNTIF(A19, "*" & {"""";"~*";"/";"\";":";"<";">";"~?";"|"} & "*")) = 0


returns TRUE

This returns True for all cells down the column B, whether A contains an invalid symbol or not
 
Upvote 0
This returns True for all cells down the column B, whether A contains an invalid symbol or not

No one here can see the what you have in the cells in column A - can you provide examples of where it is going wrong?

Excel Workbook
ABC
1Value to TestDoes NOT contain the symbolsDoes Contain the symbols
2RA1 Expenditure.xlsxTRUEFALSE
3RA1 Expendit?ure.xlsxFALSETRUE
4RA1 Exp*enditure.xlsxFALSETRUE
5RA1/Expenditure.xlsxFALSETRUE
6RA1Exp:enditure.xlsxFALSETRUE
7abcTRUEFALSE
Sheet1
 
Upvote 0
It works when I use this formula:

=SUMPRODUCT(COUNTIF(A2, "*" & {"""";"~";"#";"%";"&";"~*";"{";"}";"$";"..";"!";"~+";"£";"^";"~*";"/";":";"<";">";"~?";"|"} & "*")) > 0

Thanks for all your help anyway.
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,836
Members
449,096
Latest member
Erald

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