is there a formula/macro/script that recognizes formatting?

A

Amer Hasan

Dear listers:

I have been given an excel spreadsheet that contains a person's
selections from a menu of options.

However rather than just having the choice listed next to the person's
name, I have the entire menu listed next to each person and that
person's choice is in bold.

Is there a formula of the following type:
give me a 1 if specified text is bold and a 0 otherwise?

Here is an example. The following information is in one cell:
"o Aceptó
o No Aceptó
o No Asistió
o No es elegible"

A person's choice is in bold. I need to analyse the data and want a
formula/macro/script that gives me a new cell with a value of 1 if
answer=bold and 0 if not.

Immensely grateful for any tips/solutions.

Not a very skilled excel user
Amer
 
J

joel

You can individually select any character or characters to be bold o
not to be bold (that is the question). The code below is only checkin
the 1st character.

Function ISBold(Target As Range)
'
With Target.Characters(Start:=1, Length:=1).Font
If .FontStyle = "Bold" Then
ISBold = True
Else
ISBold = False
End If
End With
End Functio
 
G

Gord Dibben

This one will count 1 or 0 if the entire cell is bold.

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

But I don't know how to return a 1 or 0 if only part of a 4-line cell is
bold.

Maybe you could have choices in separate cells.


Gord Dibben MS Excel MVP
 
P

Phil Hibbs

But I don't know how to return a 1 or 0 if only part of a 4-line cell is

Cell.Characters(Start:=2, Length:=1).Font.Bold

That just checks if the second character is bold. The next trick is
working out where the lines begin.

Phil Hibbs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top