Is it possible to have 2 different colors for a numeric cell?

AshrafFouad

New Member
Joined
Feb 2, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have a numeric cell formatted as (#,##0 "Meters") to display --> e.g. 112 Meters
Is it possible to display the text "Meters" in a different color? --> e.g. 112 Meters

Thank you.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
 
Upvote 0
Thanks for responding.
It did change both (Number & text) to the red color.
 
Upvote 0
As was pointed out by VBE313, it is not possible to do what you are asking for.
 
Upvote 0
Sorry, the previous reply was not for you and I didn't find an edit button to my post.
For such post you shared, if the cell content is text, it is possible to have many colors in one cell, but I'm looking for many colors for a numeric field.

capture-jpg.5578
 

Attachments

  • Capture.JPG
    Capture.JPG
    27.2 KB · Views: 40
Upvote 0
As was pointed out by VBE313, it is not possible to do what you are asking for.
Thanks for responding & sorry for being late.
I found a solution, it is a workaround but the result is satisfactory.
In Microsoft community & through VBA they merge 2 cells (one numeric & the other is text in my case) with different colors in one cell with the same colors.
The displayed result after modifying the code:
Capture.JPG


VBA Code:
Sub merge()
'Starts on the first cell
Value1 = ActiveCell.Value
Color1 = ActiveCell.Font.Color
Len1 = Len(Value1)

Value2 = "Meter"
Color2 = 1256897
Len2 = 5

ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.Value = Value1 & " " & Value2
With ActiveCell.Characters(Start:=1, Length:=Len1).Font
    .Color = Color1
End With
With ActiveCell.Characters(Start:=Len1 + 2, Length:=Len2).Font
    .Color = Color2
End With
ActiveCell.Offset(1, -1).Range("A1").Select
End Sub

The only cons of this method, it is not updating automatically the "displayed text" if I changed the "value"
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

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