Underlining part of the value of a cell in Excel

Bill Golden
Bill Golden used Ask the Experts™
on
=IF(D64<>"","Discounted Cash Value for the Next "&D64&" Years (from Schedule One)","You must enter a name in B43")

When D64=7, the line appears...

Discounted Cash Value for the Next 7 Years (from Schedule One)

Can just the 7 or whatever the resulting number be underlined?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
AFAIK you can't change the formatting of a part of the cell with a formula or conditional formatting. Only VBA code is able to do that.

A way to get this working with simple means is to have the text part in own columns, only the value in its own cell, and do static formatting.
Commented:
Use this in VBA if you have one.

ActiveCell.Characters(3,1).Font.Underline = True

Open in new window

Underlining the number within a formula would not be possible. Even VBA for such a simple requirement may not be justified although possible. A simple workaround is to highlight the number 7 using some inline method instead of underlining it.

Here are examples of what I mean:

Discounted Cash Value for the Next [[[ 7 ]]] Years (from Schedule One)

Discounted Cash Value for the Next +++ 7 +++ Years (from Schedule One)

Discounted Cash Value for the Next -----> 7 Years (from Schedule One)
Bill GoldenExecutive Managing Member

Author

Commented:
I did not think there would be a precise solution.  Will try the VBA solution but will need more help in understanding how to run that option.  Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial