A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Bolding specific text in a formula



 
 
Thread Tools Display Modes
  #1  
Old September 15th, 2003, 04:42 AM
Scot Rundell`
external usenet poster
 
Posts: n/a
Default Bolding specific text in a formula

I am concatenating 3 cells, '=a2&b2&c2' and with the
result of this, i need the text that is in cell b2, to be
bold, so that i can get an answer of 'This is great'
where 'is' is in bold.

Can anyone help?
  #2  
Old September 15th, 2003, 09:18 AM
Anon
external usenet poster
 
Posts: n/a
Default Bolding specific text in a formula

"Scot Rundell`" wrote in message
...
I am concatenating 3 cells, '=a2&b2&c2' and with the
result of this, i need the text that is in cell b2, to be
bold, so that i can get an answer of 'This is great'
where 'is' is in bold.

Can anyone help?


You cannot do this. Formulas create cell content, not format. Even
conditional formatting formulas can only determine whole cell formatting,
not the formatting of part of the cell contents.


  #3  
Old September 15th, 2003, 11:04 AM
GB
external usenet poster
 
Posts: n/a
Default Bolding specific text in a formula


"Anon" none wrote in message ...
"Scot Rundell`" wrote in message
...
I am concatenating 3 cells, '=a2&b2&c2' and with the
result of this, i need the text that is in cell b2, to be
bold, so that i can get an answer of 'This is great'
where 'is' is in bold.

Can anyone help?


You cannot do this. Formulas create cell content, not format. Even
conditional formatting formulas can only determine whole cell formatting,
not the formatting of part of the cell contents.


Hmm - try typing ABC ctrl-B DEF enter

Don't think this works for formulae, though




  #4  
Old September 15th, 2003, 11:06 AM
GB
external usenet poster
 
Posts: n/a
Default Bolding specific text in a formula


"Scot Rundell`" wrote in message
...
I am concatenating 3 cells, '=a2&b2&c2' and with the
result of this, i need the text that is in cell b2, to be
bold, so that i can get an answer of 'This is great'
where 'is' is in bold.

Can anyone help?


Could you avoid concatenating - just put three narrow columns close
together, then apply conditional formatting to middle column



  #5  
Old September 15th, 2003, 06:53 PM
Harlan Grove
external usenet poster
 
Posts: n/a
Default Bolding specific text in a formula

"Scot Rundell`" wrote...
I am concatenating 3 cells, '=a2&b2&c2' and with the
result of this, i need the text that is in cell b2, to be
bold, so that i can get an answer of 'This is great'
where 'is' is in bold.

Can anyone help?


You can't do this directly. You *can* simulate this with VBA, supporting cells
and picture links. Warning: this is KLUNKY!

If you concatenate these cells in a cell in a one-column range named Mirror,
adding HTML-like formatting tags, so your formula would look like

=A1&"B"&B1&"/B"&C1

Then you could use an event handler like the following very simplified one to
render these into formatted text constants in the cells to the right of Mirror.
Note: this even handler would need to be in the VBA class module for the
worksheet containing the Mirror range.


Private Sub Worksheet_Calculate()
Dim c As Range, f As String, p As Long, q As Long

On Error GoTo CleanUp
Application.EnableEvents = False

For Each c In ThisWorkbook.Names("Mirror").RefersToRange

f = c.Text
p = InStr(1, f, "B", vbTextCompare)
q = InStr(p, f, "/B", vbTextCompare)

If p 0 And q p Then

f = Left(f, p - 1) & Mid(f, p + 3, q - p - 3) & Mid(f, q + 4)
c.Offset(0, 1).Formula = f
c.Offset(0, 1).Characters(p, q - p - 3).Font.Bold = True

End If

Next c

CleanUp:
Application.EnableEvents = True

End Sub


Finally, select the cell immediately to the right of the one containing the
concatenation formula in Mirror, Edit Copy, then select the cell where you
want the formatted result to appear, hold down a [Shift] key, and issue the menu
command Edit Paste Picture Link. You now have a picture link to the formatted
text that will update whenever any of the three source cells changes.

The event handler above could be made to handle much more complicated HTML-like
formatting. This is a stripped down example that's only intended to allow you to
assess whether or not this approach would work for you.

I'll repeat the warning, though: this is KLUNKY!

--
Never attach files.
Snip unnecessary quoted text.
Never multipost (though crossposting is usually OK).
Don't change subject lines because it corrupts Google newsgroup archives.
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.