help fix my formula

spilner

Board Regular
Joined
Jun 7, 2011
Messages
146
isbold(C13,IF(F13>3000,3000,F13)

the result return #VALUE! .can someone help to fix the code.

the code is..

Code:
' //
' // Start Code
' //
Function IsBold(Cell_To_Check As Range, Value_If_True, Value_If_False)
If Cell_To_Check.Font.Bold = True Then
IsBold = Value_If_True
Else
IsBold = Value_If_False
End If
End Function
' //
' // End Code
' //


thanks guys
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
isbold(C13,IF(F13>3000,3000,F13)

The If portion of the formula is Value_If_True argument. There is no Value_If_False argument in your formula.

I don't know what end result you want but try something like this...
=isbold(C13,IF(F13>3000,3000,F13), "not bold")

Also, simply changing the font in cell C13 wouldn't trigger the isbold function to automatically update. It would only update when there is a calculation on the sheet. That may or may not be an issue for you.
 
Upvote 0
You can write that function in two lines:

Code:
Function IsBold(Cell_To_Check As Range, Value_If_True, Value_If_False)
Application.Volatile
IsBold = IIf(Cell_To_Check.Font.Bold, Value_If_True, Value_If_False)
End Function

You can also remove the IF from your formula and use MIN instead, but as has already been started your missing your Value if False:

=isbold(C13,MIN(3000,F13),"Value if False")
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top