Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / February 2008

Tip: Looking for answers? Try searching our database.

Help req: how to conditional count with words in cells based on their formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
babs - 19 Jan 2008 02:32 GMT
I have a text based spread sheet that counts the number of words at the end
of each row. I want to be able to bold  selected words and have these
excluded from the count at the end of the row e.g.

frog     cat     dog   (If cat is bolded then the count at the end of the
row is 2 not 3).

Thanks in advance.

Babs
Jim Cone - 19 Jan 2008 12:24 GMT
That will require VBA code.

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"babs"
wrote in message
I have a text based spread sheet that counts the number of words at the end
of each row. I want to be able to bold  selected words and have these
excluded from the count at the end of the row e.g.

frog     cat     dog   (If cat is bolded then the count at the end of the
row is 2 not 3).

Thanks in advance.
Babs
T. Valko - 19 Jan 2008 23:14 GMT
Why is a cell bold?

Can you write a formula based on *why* the cell is bold?

Signature

Biff
Microsoft Excel MVP

>I have a text based spread sheet that counts the number of words at the end
>of each row. I want to be able to bold  selected words and have these
[quoted text clipped - 6 lines]
>
> Babs
babs - 20 Jan 2008 01:13 GMT
The spreadsheet is a record of students spelling results each week. I want
to be be able to bold (or change the colour) of words that are incorrect and
have these words excluded from the total at the end of the row.

Babs

> Why is a cell bold?
>
[quoted text clipped - 10 lines]
>>
>> Babs
Pete_UK - 20 Jan 2008 02:00 GMT
Chip Pearson has some notes on counting by colour here:

http://www.cpearson.com/excel/colors.htm

Perhaps you can make use of some of his routines.

Hope this helps.

Pete

> The spreadsheet is a record of students spelling results each week. I want
> to be be able to bold (or change the colour) of words that are incorrect and
[quoted text clipped - 22 lines]
>
> - Show quoted text -
babs - 20 Jan 2008 04:17 GMT
Thanks for your help

On the site I found the following code which look like it will work but I am
new to excel and unsure how to insert the code.
Any chance that someone could insert it into an excel chart for me to show
me how to do it.
I am a teacher and would appreciate any help.

Thanks in advance

Babs

Counting Cells With A Specific Color
The following function will return the number of cells in a range that have
either an Interior (background) or Font of a specified color.  InRange is
the range of cells to examine, WhatColorIndex is the ColorIndex value to
count, and OfText indicates whether to return  the ColorIndex of the Font
(if OfText is True) or the Interior (if OfText is False or omitted).

Function CountByColor(InRange As Range, _
   WhatColorIndex As Integer, _
   Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If OfText = True Then
   CountByColor = CountByColor -  _
           (Rng.Font.ColorIndex = WhatColorIndex)
Else
   CountByColor = CountByColor -  _
      (Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng

End Function

Chip Pearson has some notes on counting by colour here:

http://www.cpearson.com/excel/colors.htm

Perhaps you can make use of some of his routines.

Hope this helps.

Pete

> The spreadsheet is a record of students spelling results each week. I want
> to be be able to bold (or change the colour) of words that are incorrect
[quoted text clipped - 27 lines]
>
> - Show quoted text -
Pete_UK - 20 Jan 2008 13:48 GMT
If you are new to macros you might find this site by David MacRitchie
to be helpful:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps.

Pete

> Thanks for your help
>
[quoted text clipped - 81 lines]
>
> - Show quoted text -
T. Valko - 20 Jan 2008 05:01 GMT
Ok, here's some ideas on how to make this all happen automatically.

You have a list of the correctly spelled words as key.
You can use conditional formatting to automatically highlight cells that
contain misspelled words.
You can count the misspelled words by checking them against the key.

Signature

Biff
Microsoft Excel MVP

> The spreadsheet is a record of students spelling results each week. I want
> to be be able to bold (or change the colour) of words that are incorrect
[quoted text clipped - 16 lines]
>>>
>>> Babs
babs - 27 Jan 2008 22:09 GMT
Thanks for your help.

I have worked out how to use conditional formatting to automatically change
the colour of cells that contain misspelled words, however I don't know how
to count the misspelled words by checking them against the key.

Would you mind if I send you a small excel sample spreadsheet to look at?

Would really appreciate your help.

Babs

> Ok, here's some ideas on how to make this all happen automatically.
>
[quoted text clipped - 24 lines]
>>>>
>>>> Babs
Ken Johnson - 28 Jan 2008 12:34 GMT
Hi Babs,

Last week I got your email address from your profile then I sent you a
workbook with Chip Pearson's UDF in place. Unfortunately there was
some sort of problem and the message couldn't be delivered.

If Biff doesn't notice your last message feel free to send me a copy
of your sample workbook to have a look at and I'll see if I can get it
working.

Ken Johnson
T. Valko - 03 Feb 2008 03:42 GMT
Try this:

A1:E1 = words typed in by students

werd1...word2...word3...wurd4...word5

The word key is in the range J1:J5

word1...word2...word3...word4...word5

There are 2 misspelled words.

=SUMPRODUCT(--(ISNA(MATCH(A1:E1,J1:J5,0))))

=2

Empty cells will be counted as misspelled words.

You can prevent the count from happening until *all* cells have been filled:

=IF(COUNTA(A1:E1)<5,"",SUMPRODUCT(--(ISNA(MATCH(A1:E1,J1:J5,0)))))

You can also delay the formatting in the same manner so the student won't
see any incorrect/correct reaults until *all* cells have been filled.

Signature

Biff
Microsoft Excel MVP

> Thanks for your help.
>
[quoted text clipped - 36 lines]
>>>>>
>>>>> Babs
Ken Johnson - 03 Feb 2008 12:27 GMT
Hi Biff,
Babs sent me a sample workbook with a key row in row 6 with correctly
spelled words in F6:I6.
Student names in column D (D8:D10) and each of the three student's
spellings of the key words along their row in columns F:I.
Column K is where the formula goes for a count of each student's
correct spellings.

I filled the following down from K8...

=SUMPRODUCT(--(F8:I8=$F$6:$I$6))

which seems OK.
Babs was happy with it too.

Ken Johnson
T. Valko - 03 Feb 2008 21:25 GMT
Good deal. Thanks for letting me know.

Signature

Biff
Microsoft Excel MVP

> Hi Biff,
> Babs sent me a sample workbook with a key row in row 6 with correctly
[quoted text clipped - 12 lines]
>
> Ken Johnson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.