Conditional color formatting of individual characters in a cell

Occasional Visitor

Good day - thanks in advance for your help!

I use Excel to manage G-code for machining processes at my shop.


It would be awesome if I can condition cells containing G-Code in this way:

Every character in a cell that is a number [12345] is black.

Every character in a cell that is a letter [Abcdef] is red.

Every set of parentheses (and their contents) is green.


A cell may contain content like this when formatted:  [G00 X3.0 Y5.25 (Rapid to position)]


I've looked over conditional formatting but don't see the ability to influence colors at the character level.


Is this possible?


Thank you!


1 Reply



Awesome, maybe. Then again, maybe not.


You don't say why you'd like to do this. For the record, I don't really think it's possible (not using conditional formatting at any rate); and I'd caution against it anyway, unless there's some compelling reason.


Why caution? As I said already, unless there's some compelling reason--some essential functionality that is going to be missing from the machining process, some vulnerability to major disaster that can only be averted by that color coding--then I'd see it as fancy clutter.


Let's think about an alternative.


What you've got in that cell is fairly clearly multi-level meaning; it is not only a G-Code-itself with multiple meanings--, but a parenthetical that also has its own meaning. A word to the wise: in data processing, it's generally a mistake to make one field (aka one cell) perform multiple functions. It can lead to confusion; it can lead to disaster.


Each of those letters-- G, X, Y in your example--has certain meaning. Presumably there are other letters, each with its own meaning, which could be in those three spaces. There are presumably other potential parenthetical phrases.


My suggestion (which, given that I'm speculating from the get-go, can be tossed aside) would be to take those multi=leveled meanings embedded in those letters, and give them cells of their own where you could employ conditional formatting to highlight whatever it is that requires urgent attention, urgent and unambiguous. I would think that could be accomplished with four more cells per row, one for each of those letters and one slightly larger for the parenthetical phrase.


Take it for what it's worth