#1   Report Post  
Posted to microsoft.public.excel.misc
Paul Sheppard
 
Posts: n/a
Default Formula Help


I have a range of data in cells G4:O181

I have used =COUNTIF($G$4:$O$181,"Debs") to count the number of
occurences of Debs

In some of the cells Debs is black text and some Debs is red text

=(PERSONAL.XLS!CountByColor(G4:O181,3,TRUE)) will give me the total
number of cells that have Red Text

I have tried this formula to calculate the number of cells that are
both Debs and red text
=SUM(G4:O181="Debs")*((PERSONAL.XLS!CountByColor(G 4:O181,3,TRUE))), but
get the value zero

How can I combine the two to get the result for the number of cells in
the range that are Debs and red text

Thanks in advance for any help


--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=502384

  #2   Report Post  
Posted to microsoft.public.excel.misc
paul
 
Posts: n/a
Default Formula Help

does the count by color work?
=sumproduct(--($G$4:$O$181,"Debs")
,--(PERSONAL.XLS!CountByColor(G4:O181,3,TRUE))



--
paul
remove nospam for email addy!



"Paul Sheppard" wrote:


I have a range of data in cells G4:O181

I have used =COUNTIF($G$4:$O$181,"Debs") to count the number of
occurences of Debs

In some of the cells Debs is black text and some Debs is red text

=(PERSONAL.XLS!CountByColor(G4:O181,3,TRUE)) will give me the total
number of cells that have Red Text

I have tried this formula to calculate the number of cells that are
both Debs and red text
=SUM(G4:O181="Debs")*((PERSONAL.XLS!CountByColor(G 4:O181,3,TRUE))), but
get the value zero

How can I combine the two to get the result for the number of cells in
the range that are Debs and red text

Thanks in advance for any help


--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=502384


  #3   Report Post  
Posted to microsoft.public.excel.misc
Paul Sheppard
 
Posts: n/a
Default Formula Help


Hi Paul

Thanks for the try but it didn't work

paul Wrote:
does the count by color work?
=sumproduct(--($G$4:$O$181,"Debs")
,--(PERSONAL.XLS!CountByColor(G4:O181,3,TRUE))



--
paul
remove nospam for email addy!



"Paul Sheppard" wrote:


I have a range of data in cells G4:O181

I have used =COUNTIF($G$4:$O$181,"Debs") to count the number of
occurences of Debs

In some of the cells Debs is black text and some Debs is red text

=(PERSONAL.XLS!CountByColor(G4:O181,3,TRUE)) will give me the total
number of cells that have Red Text

I have tried this formula to calculate the number of cells that are
both Debs and red text
=SUM(G4:O181="Debs")*((PERSONAL.XLS!CountByColor(G 4:O181,3,TRUE))),

but
get the value zero

How can I combine the two to get the result for the number of cells

in
the range that are Debs and red text

Thanks in advance for any help


--
Paul Sheppard



------------------------------------------------------------------------
Paul Sheppard's Profile:

http://www.excelforum.com/member.php...o&userid=24783
View this thread:

http://www.excelforum.com/showthread...hreadid=502384




--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=502384

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Formula Help

I think I'd create a new UDF: =countbycolorandtext()

And pass it one more parameter--the text you're looking for.

Then add a line that checks if the text matches the cell value (within the UDF).

Something like:

Option Explicit
Function CountByColorText(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False, _
Optional Str As String = "") As Long

Dim Rng As Range
Dim CheckStr As Boolean
Application.Volatile True

For Each Rng In InRange.Cells
CheckStr = False
If Str = "" _
Or LCase(Rng.Value) = LCase(Str) Then
CheckStr = True
End If

If CheckStr = True Then
If OfText = True Then
CountByColorText = CountByColorText - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColorText = CountByColorText - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
End If
Next Rng

End Function

And use it like:
=countbycolortext(B10:G23,6,TRUE,"debs")

ps. I took the original =countbycolor() function from Chip Pearson's site:
http://cpearson.com/excel/colors.htm


Paul Sheppard wrote:

I have a range of data in cells G4:O181

I have used =COUNTIF($G$4:$O$181,"Debs") to count the number of
occurences of Debs

In some of the cells Debs is black text and some Debs is red text

=(PERSONAL.XLS!CountByColor(G4:O181,3,TRUE)) will give me the total
number of cells that have Red Text

I have tried this formula to calculate the number of cells that are
both Debs and red text
=SUM(G4:O181="Debs")*((PERSONAL.XLS!CountByColor(G 4:O181,3,TRUE))), but
get the value zero

How can I combine the two to get the result for the number of cells in
the range that are Debs and red text

Thanks in advance for any help

--
Paul Sheppard

------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=502384


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
Paul Sheppard
 
Posts: n/a
Default Formula Help


Dave

Thanks, that worked

Paul

Dave Peterson Wrote:
I think I'd create a new UDF: =countbycolorandtext()

And pass it one more parameter--the text you're looking for.

Then add a line that checks if the text matches the cell value (within
the UDF).

Something like:

Option Explicit
Function CountByColorText(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False, _
Optional Str As String = "") As Long

Dim Rng As Range
Dim CheckStr As Boolean
Application.Volatile True

For Each Rng In InRange.Cells
CheckStr = False
If Str = "" _
Or LCase(Rng.Value) = LCase(Str) Then
CheckStr = True
End If

If CheckStr = True Then
If OfText = True Then
CountByColorText = CountByColorText - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColorText = CountByColorText - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
End If
Next Rng

End Function

And use it like:
=countbycolortext(B10:G23,6,TRUE,"debs")

ps. I took the original =countbycolor() function from Chip Pearson's
site:
http://cpearson.com/excel/colors.htm


Paul Sheppard wrote:

I have a range of data in cells G4:O181

I have used =COUNTIF($G$4:$O$181,"Debs") to count the number of
occurences of Debs

In some of the cells Debs is black text and some Debs is red text

=(PERSONAL.XLS!CountByColor(G4:O181,3,TRUE)) will give me the total
number of cells that have Red Text

I have tried this formula to calculate the number of cells that are
both Debs and red text
=SUM(G4:O181="Debs")*((PERSONAL.XLS!CountByColor(G 4:O181,3,TRUE))),

but
get the value zero

How can I combine the two to get the result for the number of cells

in
the range that are Debs and red text

Thanks in advance for any help

--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile:

http://www.excelforum.com/member.php...o&userid=24783
View this thread:

http://www.excelforum.com/showthread...hreadid=502384

--

Dave Peterson



--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=502384

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Hide formula skateblade Excel Worksheet Functions 10 October 15th 05 08:36 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM
Match / Vlookup within an Array formula Hari Prasadh Excel Discussion (Misc queries) 3 February 3rd 05 04:37 PM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM


All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"