Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

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

 
Question Tools Search this Question Display Modes
Question
 
 
#1  
Old Oct 25, 2006, 03: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, 05:21 AM   #2  
ScottGem
Computer Expert
ScottGem is offline
 
ScottGem's Avatar
 
Join Date: Jan 2003
Location: LI, NY - USA
Posts: 22,608
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, 02:42 AM   #3  
ahmed kamal
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, 05:00 AM   #4  
ScottGem
Computer Expert
ScottGem is offline
 
ScottGem's Avatar
 
Join Date: Jan 2003
Location: LI, NY - USA
Posts: 22,608
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, 09:33 AM   #5  
miss-java
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
 
     


Question Tools Search this Question
Search this Question:

Advanced Search
Display Modes

 
Similar Sponsors

Similar Questions
Question Asker Topic Answers Last Post
Does Sincerity Count? Starman Christianity 19 May 4, 2007 09:57 PM
Another Count Question mccloudm Spreadsheets 1 Oct 15, 2006 11:28 AM
count question grumpy2001 Spreadsheets 2 Oct 12, 2006 10:04 AM
How to remove a character using Excel function dogdog3 Spreadsheets 3 Aug 5, 2006 05:01 AM
Excel count function fyogi1 Spreadsheets 7 Apr 26, 2006 06:10 AM




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

Content Relevant URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc.