Trying to bold or color part of a formula result

September 12, 2012 at 15:18:01
Specs: Windows XP
Ultimately, I'm trying to BOLD part of a formula result.
In trying to do so, I've experimented with the following:

Type in:
A1: -5000
A2: ="Let's try to get color in the result "&TEXT(A2,"$#,##0_);[Red]($#,##0)")

The result doesn't show as red.
Figured it would as this is where I usually cut/paste TEXT formatting options from.
Any insight as to why this wouldn't work?


See More: Trying to bold or color part of a formula result

Report •

#1
September 12, 2012 at 16:20:50
Your TEXT() formula contains formats that are not recognized by the TEXT() function.

See here for a list of format strings that the TEXT() function recognizes:

http://office.microsoft.com/en-us/e...

MIKE

http://www.skeptic.com/


Report •

#2
September 13, 2012 at 06:36:19
Before I worried about the formatting, I'd be concerned with the Circular Reference caused by referencing the same cell in which the formula resides.

That's not ever going to work, regardless of what formatting codes are used.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#3
September 13, 2012 at 07:00:22
That was a typo

Report •

Related Solutions

#4
September 13, 2012 at 07:26:41
As far as I know, you can not change the color of part of a text string via a formula.

I do know that it can be done with VBA, but the cell must contain text, not a formula.

This code will place the string you are using in A2 and color the number red if the number in A1 is negative. As written, it needs to be run manually, but if you'll supply some details as to how the number in A1 is changed, there may be a way to automate it.

Sub ColorMyNumber()
  Range("A2") = "Let's try to get color in the result ($" & Range("A1") & ")"
   If Range("A1") < 0 Then
     Range("A2") = "Let's try to get color in the result ($" & Range("A1") * -1 & ")"
       startChar = InStr(Range("A2"), "(")
       endChar = InStr(Range("A2"), ")") + 1
          Range("A2").Characters _
             (Start:=startChar, Length:=endChar - startChar).Font.ColorIndex = 3
   End If
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Ask Question