Go Back   Talk Microsoft > Microsoft Operating Systems & Software > Microsoft Office Family

Reply
     I need help with microsoft Excel spreadsheet?  
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-28-2007, 11:20 AM
Junior Member
 
Join Date: Sep 2007
Posts: 1
Default I need help with microsoft Excel spreadsheet?

Is it possible to do a count by colour of text? Say for example in 1 column i have green, red and purple text count i count the occurances of each colour?
Is there a way i can return a true or false value from coloured text? i am not using numbers so am struggling
Reply With Quote
Links
  #2 (permalink)  
Old 09-28-2007, 01:41 PM
Junior Member
 
Join Date: Sep 2007
Posts: 1
Default

No. Rather than using colours, you would be better off adding a new column & populating it with values.
Reply With Quote
  #3 (permalink)  
Old 09-28-2007, 01:53 PM
Junior Member
 
Join Date: Sep 2007
Posts: 1
Default

Not sure in Excel itself, but you can certianly write a macro along the line of

cells(1,2).value = Cells(1, 1).Interior.ColorIndex

this will give a numberical value of the colour of cell (1,1) so you can go through and find all cells in a range that have that colour
Reply With Quote
  #4 (permalink)  
Old 09-28-2007, 01:56 PM
Junior Member
 
Join Date: Sep 2007
Posts: 4
Default

The link below has a VBA soution - creating a user defined function...

Function CountColor(rColor As Range, rSumRange As Range)

''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com

'Counts cells based on a specified fill color.
'''''''''''''''''''''''''''''''''''''''
Dim rCell As Range
Dim iCol As Integer
Dim vResult

iCol = rColor.Interior.ColorIndex

For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = vResult + 1
End If
Next rCell

CountColor = vResult
End Function

--------------------------------------------------------------------------------

To use these UDF's push Alt+F11 and go Insert>Module and paste in the code. Push Alt+Q and save. The Function will appear under "User Defined" in the Paste Function (Shift+F3).
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:40 AM.