If font is strikethrough...

dl7631

Board Regular
Joined
Mar 6, 2009
Messages
114
Hi!
I have a string entry in A1 that is in strikethrough font. In B1, I'd like to write a formula - something like:
If (effect in A1 = strikethrough, 1, 0)
Is it possible? What is the correct formula?
Thanks a lot!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
use a custom function:

Function ist(r1 As Range) As Boolean
ist = r1.Font.Strikethrough
End Function

the function can then be used as =IST(a1)
 
Upvote 0
Create a named range, call it Strike

in the 'refrs to' box enter =GET.CELL(23,INDIRECT("RC[-1]",0))

Then use the formula

=IF(Strike,1,0)

Note that this assumes the cell with the strikethru text will be to the immediate left of the formula.
 
Upvote 0
If you're going with the UDF I would advise a small change.

Rich (BB code):
Function ist(r1 As Range) As Boolean
Application.Volatile
ist = r1.Font.Strikethrough
End Function
 
Upvote 0
The op wants to return a 1 or a 0:


Code:
Function ist(r1 As Range) As Byte
Application.Volatile
ist = abs(r1.Font.Strikethrough)
End Function

Hit F9 to recalculate if you change the strikethrough.

Excel Workbook
AB
111
Sheet1
 
Upvote 0
The op wants to return a 1 or a 0:


You sound a touch over-sure of yourself there,

I'd like to write a formula - something like: If (effect in A1 = strikethrough, 1, 0)

That looks more like a logical test being required, with 1 and 0 shown for results to keep the example simple, something which the UDF provided by sahild05 was adequate for, it just needed to be made volatile to allow it to recalculate.
 
Upvote 0
I'm just saying that if the op wants to return a 0 or 1 as per the example given, you could write the UDF to do exactly that, rather than embed it in an IF function.

I'm not over sure of myself that's the example the op gave. Are you psychic? How could you possibly know that the sample formula is not what the op wants?
 
Last edited:
Upvote 0
I'm just saying that if the op wants to return a 0 or 1 as per the example given, you could write the UDF to do exactly that, rather than embed it in an IF function.

My apologies hotpepper, but the opening line of your first reply came out as an adamant statement that the OP definitely wanted to return a 1 or 0 result, rather than a suggestion to a direct alternative if it was suitable.

Are you psychic?

I thought that was a mandatory requirement :)
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,876
Members
452,949
Latest member
Dupuhini

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