ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If formulae using formats (https://www.excelbanter.com/excel-worksheet-functions/16807-if-formulae-using-formats.html)

Paul

If formulae using formats
 
Hi,
I want to write a formula along the lines of:

=if( b2 is bold, b2, else "")

Any ideas would be welcome.

PS the Excel is 2002.
Thanks for looking

Paul

Bob Phillips

Paul,

You could add a UDF like so

'-----------------------------------------------------------------
Function IsBold(rng As Range)
'-----------------------------------------------------------------
If rng.Areas.Count 1 Then
IsBold = CVErr(xlErrValue)
Exit Function
ElseIf rng.Cells.Count 1 Then
IsBold = CVErr(xlErrValue)
Exit Function
Else
IsBold = rng.Font.Bold
End If

End Function


and then use

=IF(IsBold(B2),B2,"")

but be aware that bold does not trigger the calculate event so if B2 is
changed, you formula will not update.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Paul" wrote in message
...
Hi,
I want to write a formula along the lines of:

=if( b2 is bold, b2, else "")

Any ideas would be welcome.

PS the Excel is 2002.
Thanks for looking

Paul




CLR

If B2 is BOLD because of Conditional Formatting, then just replace the "B2
is bold" in your formula with whatever conditions actually make B2
BOLD.........but the BOLD will not carry through to your new result just
using a formula............also, you do not need the "else" in your
formula..........

Vaya con Dios,
Chuck, CABGx3


"Paul" wrote in message
...
Hi,
I want to write a formula along the lines of:

=if( b2 is bold, b2, else "")

Any ideas would be welcome.

PS the Excel is 2002.
Thanks for looking

Paul





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com