How to Format Only Part of an Excel Cell (Conditional Formatting)
Question details
The user wants to apply conditional formatting to only specific characters or a partial segment of a text value inside an Excel cell.

- Product
- Excel
- Device & OS
- Windows, Mac
- Scenario
- Attempting to apply automated styling to highlight only a portion of a cell's text or formula result based on specific conditions.
- Observed behavior
- Excel's native conditional formatting applies strictly to the entire cell and cannot automatically color or style only part of a text value or formula result.
Be aware that standard conditional formatting cannot target specific characters within a cell. You will need to use a VBA macro, which requires saving your workbook as a Macro-Enabled Workbook (.xlsm).
Use a VBA Macro for Partial Text Formatting
Since built-in conditional formatting affects the whole cell, using a VBA macro is the most effective workaround to identify and format specific characters.
VBA (Visual Basic for Applications) allows you to target specific text strings within a cell using the Characters object. This method enables you to apply custom styling to partial text automatically. Note that this approach requires manual re-triggering or an event handler if the cell contents update dynamically.
Press 'Alt + F11' (on Windows) or 'Option + F11' (on Mac) to launch the VBA Editor in Excel.
Click 'Insert' in the top menu and select 'Module' to open a new blank script window.
Enter your VBA script utilizing the '.Characters(Start, Length)' object to target the specific text and apply properties like '.Font.Color' or '.Font.Bold'.
Go to 'File' > 'Save As' and change the file format to 'Excel Macro-Enabled Workbook (*.xlsm)' so your code is preserved.
Return to your worksheet, navigate to the 'Developer' tab, click 'Macros', select your script, and click 'Run' to apply the partial formatting.
Experience Seamless Spreadsheets with WPS Office
While native conditional formatting limits partial text styling across major spreadsheet apps, WPS Office offers a free, highly compatible alternative to Microsoft Office. Enjoy lightweight installation and a familiar interface for all your data formatting needs.
- 1. Download and Install: Get WPS Office for free from the official website and install it quickly on your Windows or Mac device.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your existing Excel workbooks seamlessly without losing any layout data.
- 3. Edit and Format: Use the comprehensive formatting tools to edit your data efficiently without worrying about cross-platform compatibility issues.

Frequently Asked Questions
Can I conditionally format part of a formula result in Excel?
No, conditional formatting strictly applies to the entire cell and cannot style only a portion of a formula's output. To format partial text, you must convert the formula to static text and use a VBA macro to apply styling.
Does Excel for the Web support VBA for partial formatting?
No, VBA macros are not supported in Excel for the Web, iOS, or Android. You must use the desktop versions of Excel for Windows or Mac to run VBA scripts and format specific characters.
Is there a manual way to format only part of a cell?
Yes. Double-click the cell or press F2 to enter edit mode, highlight the specific characters you want to change, and apply formatting directly from the Home tab. However, this process cannot be automated via conditional formatting rules.




