Can I highlight individual characters in a cell?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,687
Office Version
  1. 365
Platform
  1. Windows
I have a column of data that shows whether a value is over or under a target value. I have the over values (>0) highlighted in red and the under values in green. By "highlight" I mean the fill color, not the color of the characters themselves.

The column has a header with the characters "O/U". I would like to highlight the "O" in red and the "U" in green. If I edit the cell, the text color control is active, but the fill control is greyed out. I can easily do this in Word. Is it not possible in Excel?

Thanks
 
You need something like this

3de0b4a2c0a5d2915496bd7d6ebdb869.jpg

https://www.dropbox.com/s/9lkbpzs7ztr6e3g/ou.jpg?dl=0

Exactly! How did you do that?
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Ok, try...
Rclick on cell>>format cells>>Fill tab>> fill effects>>edit to suit.
Sadly that will be as close as you get !
Yep, that affects the entire cell, not individual characters.


on the other matter

By not adding attachments, you security is more protected, the forum generally is more protected, the forum is not filled with unnecessary data.
Somehow, a lot of other forums seem to manage it.

Suggesting the administrators "don't know" or "don't believe", is a bit much, considering that this site is one of the more popular ones AND has been for a very long time !!
Quite right. It is one of the best forums that I am aware of. But it has that one little details...

Had you read the guidelines for posting you would have seen the section on how to post images and or data
https://www.mrexcel.com/forum/board-announcements/127080-guidelines-forum-use.html
I did read that, but they all require that I install add-ins. Add-ins have caused me so many problems, that I avoid them at almost all costs. And how are these "attachements" more secure that any other kind?

As well as the fact that you could have used dropbox to upload you attachment, then post a link back here.
That's what I have done in the past. It's OK, but it's several extra steps for me and for anyone who wants to view it.

I'll shut up now.
 
Upvote 0
Hi,

Would you be opposed to simply adding a shape with the appropriate color and changing the transparency for each shape so the letter will show?

I'm not sure what you mean, but I am probably not opposed to anything that works.
 
Upvote 0
I guess we were a bit mislead by the thread title
Can I highlight individual characters in a cell

and your comment within that thread

I would like to highlight the "O" in red and the "U" in green.

I think that Dantes reply is based on 2 small text boxes, side by side ??
I hope you find a suitable resolution....:beerchug:
 
Upvote 0
Or for a VBA solution
This assumes the "O/U" column is Column "A" and does everything in that column

Code:
Sub MM1()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = 2 To lr
    If InStr(Cells(r, 1).Value, "O") Then Cells(r, 1).Characters(Start:=1, Length:=1).Font.Color = -16776961
    If InStr(Cells(r, 1).Value, "U") Then Cells(r, 1).Characters(Start:=3, Length:=1).Font.Color = -11489280
Next r
End Sub

Can I adapt this so it will highlight the calling cell? I will pass it a minimum and maximum value. It will set the Fill color to green if the value in the calling cell is within the range, red otherwise.

Something like this?

Code:
Sub OverUnder(Minimum, Maximum)

Dim CellValue as long
CellValue = ???

Select Case CellValue
   Case < Minimum
      Cells(?, 1).Fill.Color = Red
   Case > Maximum
      Cells(?, 1).Fill.Color = Red
   Case Else
      Cells(?, 1).Fill.Color = Green
End Select

End Sub
 
Upvote 0
Can I adapt this so it will highlight the calling cell?
"Calling cell" means the procedure would be implemented as a UDF, and a UDF can't do that. With some odd exceptions, a UDF can't do anything except return a value to the cell in which it appears.
 
Upvote 0
Exactly! How did you do that?

3de0b4a2c0a5d2915496bd7d6ebdb869.jpg


It is an image edited in paint. In excel that is not possible in a single cell.
But you can put each letter in three cells and combine the cells in rows 2 down, check the following example:


Excel Workbook
ABCDE
1ValueTargetO/U
212010020
38090-10
4150180-30
5755025
Hoja8
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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