PC Review


Reply
Thread Tools Rate Thread

Colour numbers within my formulae

 
 
Midnight Moocher
Guest
Posts: n/a
 
      23rd Dec 2005
I have been playing around with the '&' function, allowing me to mix text
with calculations and cell references.

I have the following at the moment:

="Of the "&TEXT(J954,"£#,0.00")&" made this year, I have managed to save
"&TEXT(100/J954*J955, "#,#0.0")&"%"

Which gives me a cell displaying the following:

Of the £0.00 made this year, I have managed to save 0.0%

What I would like to do is show the numbers (£0.00; 0.0%) in the colour
blue. I don't want to add conditional formatting, just apply a colour so
that the number stands out.

I think this involves entering ;[Blue] somewhere within the equation but
I've tried a few combinations and have not been unsuccessful. Is it
possible, and if so, what do I need to do to the existing cell?

Many Thanks and Merry Christmas,
Midnight.


 
Reply With Quote
 
 
 
 
Peo Sjoblom
Guest
Posts: n/a
 
      23rd Dec 2005
Not possible using formatting, you can never format part of a formula
you can copy and paste special as values and then highlight the number part
and format that part.


--

Regards,

Peo Sjoblom

"Midnight Moocher" <(E-Mail Removed)> wrote in message
news:IWUqf.11898$(E-Mail Removed)...
> I have been playing around with the '&' function, allowing me to mix text
> with calculations and cell references.
>
> I have the following at the moment:
>
> ="Of the "&TEXT(J954,"£#,0.00")&" made this year, I have managed to save
> "&TEXT(100/J954*J955, "#,#0.0")&"%"
>
> Which gives me a cell displaying the following:
>
> Of the £0.00 made this year, I have managed to save 0.0%
>
> What I would like to do is show the numbers (£0.00; 0.0%) in the colour
> blue. I don't want to add conditional formatting, just apply a colour so
> that the number stands out.
>
> I think this involves entering ;[Blue] somewhere within the equation but
> I've tried a few combinations and have not been unsuccessful. Is it
> possible, and if so, what do I need to do to the existing cell?
>
> Many Thanks and Merry Christmas,
> Midnight.
>
>



 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      23rd Dec 2005
This requires using a VBA macro, since formulae cannot change cell
formats (including color).

If you want to automate it, here's one way:

Private Sub Worksheet_Calculate()
Const sTemplate As String = _
"Of the £ made this year, I have managed to save %"
Dim dTotal As Double
Dim dSaved As Double
Dim nColor As Long
Dim nTotalPos As Long
Dim nPercentPos As Long
Dim sTotal As String
Dim sPercent As String
nColor = RGB(0, 0, 255)
With Range("J955")
If IsNumeric(.Value) Then dSaved = CDbl(.Value)
End With
With Range("J954")
If IsNumeric(.Value) Then dTotal = CDbl(.Value)
End With
sTotal = Format(dTotal, "£#,0.00")
If dTotal > 0 Then
sPercent = Format(dSaved / dTotal, "0.0%")
Else
sPercent = "(N/A)"
End If
nTotalPos = InStr(sTemplate, "£")
nPercentPos = InStr(sTemplate, "%") + Len(sTotal) - 1
With Range("A1")
Application.EnableEvents = False
.Value = Replace(Replace(sTemplate, _
"£", sTotal), "%", sPercent)
Application.EnableEvents = True
.Font.ColorIndex = xlColorIndexAutomatic
.Characters(nTotalPos, Len(sTotal)).Font.Color = nColor
.Characters(nPercentPos, Len(sPercent)).Font.Color = nColor
End With
End Sub




In article <IWUqf.11898$(E-Mail Removed)>,
"Midnight Moocher" <(E-Mail Removed)> wrote:

> I have been playing around with the '&' function, allowing me to mix text
> with calculations and cell references.
>
> I have the following at the moment:
>
> ="Of the "&TEXT(J954,"£#,0.00")&" made this year, I have managed to save
> "&TEXT(100/J954*J955, "#,#0.0")&"%"
>
> Which gives me a cell displaying the following:
>
> Of the £0.00 made this year, I have managed to save 0.0%
>
> What I would like to do is show the numbers (£0.00; 0.0%) in the colour
> blue. I don't want to add conditional formatting, just apply a colour so
> that the number stands out.
>
> I think this involves entering ;[Blue] somewhere within the equation but
> I've tried a few combinations and have not been unsuccessful. Is it
> possible, and if so, what do I need to do to the existing cell?
>
> Many Thanks and Merry Christmas,
> Midnight.

 
Reply With Quote
 
Midnight Moocher
Guest
Posts: n/a
 
      25th Dec 2005
Thanks for the response. I'll just make do with what I've got at the moment.

I feel like I've come a long way with functions within the cells themselves,
but I don't know much about Visual Basic script.

Speaking of which, any good beginners guides out there (that are fairly easy
to follow)?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with formulae comparing date-based numbers Dataslinger Microsoft Excel Worksheet Functions 2 16th Mar 2010 04:21 PM
Using formulae to change the colour of cells in Excel joeafro84@hotmail.com Microsoft Excel Misc 7 7th Feb 2007 03:55 PM
Getting range of cells with specific text colour, then using in a COUNTIF formulae CheekyFlash Microsoft Excel Programming 3 11th Oct 2006 05:01 PM
adding two highest numbers formulae =?Utf-8?B?Y2FtbWE=?= Microsoft Excel Programming 2 7th Sep 2006 04:04 AM
Delete cell contents that contain numbers and not formulae ... Rob Keel Microsoft Excel Programming 3 22nd Sep 2005 03:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:29 PM.