Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Referencing Non-bold in a formula

If AU2 is greater than AU1 and if AU2 contains non-bold formatting, I want to
return the answer "BAD" in AW2. My current formula is set up only for the
first argument but not the non-bold part:
=IF(AU2AU1,"BAD",0)

Any thoughts on how to do this?

Thanks,
Bob
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Referencing Non-bold in a formula

You would need a user defined function (UDF) to do this but there is a
caveat to consider. If the cell is bolded as result of conditional
formatting what I'm about to suggest won't work. Also, if the cell is
manually bolded, changing a cell format does not trigger a calculation so
any formula will not update when the format is changed and will only update
when some other event triggers a calculation.

In my humble opinion you should not base any calculations on a cell format
for the reasons I've noted above. You should create a formula based on the
logic of *why* the cell is bolded. That being said...

Create this UDF.

Option Explicit
Function IsBold(ACell As Range) As Boolean
Application.Volatile
If ACell.Font.Bold Then
IsBold = True
Else
IsBold = False
End If
End Function

Paste the code above into a general module.

Then your formula would be:

=IF(AND(COUNT(AU1:AU2)=2,AU2AU1,NOT(IsBold(AU2))) ,"Bad",0)

--
Biff
Microsoft Excel MVP


"bob" wrote in message
...
If AU2 is greater than AU1 and if AU2 contains non-bold formatting, I want
to
return the answer "BAD" in AW2. My current formula is set up only for the
first argument but not the non-bold part:
=IF(AU2AU1,"BAD",0)

Any thoughts on how to do this?

Thanks,
Bob



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Referencing Non-bold in a formula

You can stick this UDF in a module in your workbook then use the formula below.

Function CountBold(rg As Range) As Long
''originally posted by Ron Rosenfeld
Dim c As Range
For Each c In rg
CountBold = CountBold - c.Font.Bold
Next c
End Function


=IF(AND(AU2AU1,CountBold(AU2)<1),0,"BAD")


Gord Dibben MS Excel MVP

On Wed, 28 Nov 2007 10:29:00 -0800, bob wrote:

If AU2 is greater than AU1 and if AU2 contains non-bold formatting, I want to
return the answer "BAD" in AW2. My current formula is set up only for the
first argument but not the non-bold part:
=IF(AU2AU1,"BAD",0)

Any thoughts on how to do this?

Thanks,
Bob


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Over keying a formula - Can I set this to automatically bold ? Dave Excel Worksheet Functions 6 August 17th 06 05:21 PM
Is it possible to make a word in a formula bold? SpielbergRules Excel Worksheet Functions 5 July 2nd 06 06:59 PM
Join bold and non-bold text in one cell bkincaid Excel Discussion (Misc queries) 3 March 21st 06 12:58 AM
how would I put the results of a formula in bold print... traybuddy Excel Discussion (Misc queries) 3 October 14th 05 08:03 PM
Bold part of formula results Rita Palazzi Excel Discussion (Misc queries) 4 December 16th 04 07:51 PM


All times are GMT +1. The time now is 02:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"