Is it possible to display part of the cell in bold font?

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
528
Office Version
  1. 365
Platform
  1. Windows
Hello,

I join a series of two cells together with a slash in between, such that the cell shows the two numbers as a fraction, such as below:

C1=A1&"/"&B1

I'm wondering if it's possible to have the numerator be displayed in bold font, while the slash and the denominator are in regular font (and ideally grayed out if possible).

Thanks a lot for any input.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
No, you cannot format parts of a value returned by a formula differently than other parts of that return value... you can only do such different formatting if the cell contains a text constant. It would be possible to do what you asked if you remove the formula from the cell(s) and use a Change event procedure to produce the same output that the formula would produce. Are you interested and able to use VBA code in your workbook?
 
Upvote 0
I don't believe you can modify the result of a formula....unless it can be done programatically.
 
Upvote 0
Upvote 0
No, you cannot format parts of a value returned by a formula differently than other parts of that return value... you can only do such different formatting if the cell contains a text constant. It would be possible to do what you asked if you remove the formula from the cell(s) and use a Change event procedure to produce the same output that the formula would produce. Are you interested and able to use VBA code in your workbook?

Thank you Rick, yes please post the VBA solution if you get a chance. I'm able to use VBA at very basic level. Usually, I copy/paste the entire sheet as number to get rid of the formulas, so the sheet now contains no formulas and is just text string.
 
Upvote 0
For cells in column C, assuming the conversion to just text has already happened, try this.
If the conversion from formula has not already happened, uncomment the green line.
Rich (BB code):
Sub PartialFormat()
  Dim c As Range
  Dim pos As Long
  
  For Each c In Range("C1", Range("C" & Rows.Count).End(xlUp))
    pos = InStr(1, c.Value, "/")
    If pos > 0 Then
      'c.Value = c.Value
      c.Font.ColorIndex = 15
      With c.Characters(Start:=1, Length:=pos - 1).Font
        .Color = vbBlack
        .Bold = True
      End With
    End If
  Next c
End Sub
End Sub
 
Last edited:
Upvote 0
Thanks a lot Peter :) You're the absolute number one :)
 
Upvote 0

Forum statistics

Threads
1,215,136
Messages
6,123,243
Members
449,093
Latest member
Vincent Khandagale

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