Skip to main content

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.
doc turn off auto complete 1

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
	End Function

doc turn off auto complete 1

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....
doc turn off auto complete 1

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.
doc turn off auto complete 1

6. Click Format button to go to the Format Cells dialog, specify the format as you need. Then Click OK > OK.
doc turn off auto complete 1

Now the cells that contain symbols have been conditional formatted.

Other Operations (Articles)

Display Specific Symbol Based On Cell Value in Excel
How to display specific symbols based on cell value?

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.

Excel: How To Create Or Insert A Bookmark
Have you ever imagined creating or inserting a bookmark for quickly jumping to a specific data range while there is a lot of data in a worksheet or a workbook?

How to apply shading to odd or even (alternative) rows/columns in Excel?
While designing a worksheet, many people tend to apply shading to odd or even (alternative) rows or columns in order to make the worksheet more visual. This article will show you two methods to apply shading to odd or even rows/columns in Excel.

  • 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...
kte tab 201905
  • 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!
officetab bottom




Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations