Excel: How to conditional formatting cells that contain symbol
Conditional Formatting feature is used to highlight cells that contain specified characters, but for highlighting cells containing any symbol such as question mark (?), or exclamation point (!) as the below screenshot shows, the built-in feature cannot directly solve the problem. Here introduces a VBA code that handles this job.
Note: the methods provided in this tutorial are tested in Excel 2021, there may be some different in different Excel verisions.
Conditonal formatting cells that contain symbol
1. Enable the worksheet that you want to highlight cells containing symbols, press Alt + F11 keys.
2. Then the Microsoft Visual Basic for Applications window pops up, click Insert > Module to insert a new blank module.
3. Copy and paste the below code to the new module.ula to the cells.
VBA: Conditional formatting cells contain symbol
Function NotABCOrNumber(mTxt As String) As Boolean
Dim xStr As String
xStr = "*[!A-Za-z0-9 ]*"
On Error Resume Next
NotABCOrNumber = mTxt Like xStr
4. Save the code and come back to the worksheet. Select the cells you want to apply the conditional formatting, click Home > Conditional Formatting > New Rule....
5. In the New Formatting Rule dialog, click Use a formula to determine which cells to format, then type a formula =NotABCOrNumber(A2) into the textbox under Format values where this formula is true.
6. Click Format button to go to the Format Cells dialog, specify the format as you need. Then Click OK > OK.
Now the cells that contain symbols have been conditional formatted.
Other Operations (Articles)
How To Reduce Excel File Size?
Sometimes, it will take minutes to open or save if the Excel file is too large. For solving this problem, here in this tutorial, it tells you how to reduce the Excel file size by removing the contents or formats which are unnecessary or never used.
The Best Office Productivity Tools
- Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
- Merge Cells/Rows/Columns and Keeping Data; Split Cells Content; Combine Duplicate Rows and Sum/Average... Prevent Duplicate Cells; Compare Ranges...
- Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
- Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
- Favorite and Quickly Insert Formulas, Ranges, Charts and Pictures; Encrypt Cells with password; Create Mailing List and send emails...
- Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
- Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
- Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
- Pivot Table Grouping by week number, day of week and more... Show Unlocked, Locked Cells by different colors; Highlight Cells That Have Formula/Name...
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by
50%, and reduces hundreds of mouse clicks for you every day!