Ask Experts Questions for FREE Help!
Ask    ||    Answer
 
Advanced  
 

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Software > Spreadsheets   »   Excel Count Function

 
Thread Tools Search this Thread Display Modes
Question
 
 
#1  
Old Oct 25, 2006, 04:14 AM
eddiegeorge
New Member
eddiegeorge is offline
 
Join Date: Oct 2006
Posts: 1
eddiegeorge See this member's comment history on his/her Profile page.
Excel Count Function

In November 2004 Leif 5233 wrote the following regarding counting cells highlighted in a certain colour:

------------------
Create this function:

Function CountCol(SumRange As Range, intColor As Integer) As Integer
Dim i As Integer
Dim Cell As Range

Set SumRange = SumRange.SpecialCells(xlCellTypeAllFormatCondition s)

For Each Cell In SumRange
If Cell.Interior.ColorIndex = intColor Then
i = i + 1
End If

Next Cell

CountCol = i

End Function

Then in the cell where you would like the total, put the following formula:

=CountCol(a1:a100,6)

That formula will show you the total count of all cells with colorindex of 6 (Yellow) in range a1:a100. You can fix it up to use color names if you like, but this works fine for me. There is a listing of basic colorindexes in Excel's help.

Hope this helps,
Leif
-----------------

This works great unless the cell is highlighted as a result of conditional formating. Is there any way of counting cells that are highlighted due to conditional formating?

Reply With Quote
 
     

Answers
 
 
Old Oct 25, 2006, 06:21 AM   #2  
Computer Expert and Renaissance Man
ScottGem is online now
 
ScottGem's Avatar
 
Join Date: Jan 2003
Location: LI, NY - USA
Posts: 33,676
ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.
Pay to call ScottGem for advice ($.75/min)
Call ScottGem via Skype™
Instead of checking the format of the cell, check the condition. You can modify the line:

If Cell.Interior.ColorIndex = intColor Then

To test for the condition rather than the colorindex.
  Reply With Quote
 
     
 
 
Old Oct 26, 2006, 03:42 AM   #3  
New Member
ahmed kamal is offline
 
Join Date: Oct 2006
Posts: 2
ahmed kamal See this member's comment history on his/her Profile page.
. I have 2 sets of data (x and y), I want to count (less than and more than) above each data (for x and y) and also (less than and more than) below the data itself (for x and y). This is for each data x and y. What is the proper function I can use. Many thanks
  Reply With Quote
 
     
 
 
Old Oct 26, 2006, 06:00 AM   #4  
Computer Expert and Renaissance Man
ScottGem is online now
 
ScottGem's Avatar
 
Join Date: Jan 2003
Location: LI, NY - USA
Posts: 33,676
ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.
Pay to call ScottGem for advice ($.75/min)
Call ScottGem via Skype™
Not sure I follow. If you want to compare X and Y and count how many times x > y and y > x, then I would add a column with an expression like:

=IF(A2>B2,"Over","Under")

This assumes that x is in the A column and Y in the B Column. The result will put the text Over and Under for each row. You can then use CountIf to count each.
  Reply With Quote
 
     
 
 
Old Mar 22, 2007, 10:33 AM   #5  
New Member
miss-java is offline
 
miss-java's Avatar
 
Join Date: Mar 2007
Posts: 4
miss-java See this member's comment history on his/her Profile page.
http://www.askmehelpdesk.com/other-p...tml#post335426
(any one could help me with this ..i would be thankfull)
  Reply With Quote
 
     

Your Answer
Email me when someone replies to my answer
Join Login





Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

 
Similar Sponsors


Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Similar Threads
Does Sincerity Count?
(19 replies)
Another Count Question
(1 replies)
count question
(2 replies)
How to remove a character using Excel function
(3 replies)
Excel count function
(7 replies)

Search this Thread

Advanced Search

Bookmarks

Sponsors



Copyright ©2003 - 2009, Ask Me Help Desk.
All times are GMT -8. The time now is 02:07 PM.