Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Archive: Business Applications
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications > Archive: Business Applications >
Solved: A quick COUNTIF solution

Reply  
Thread Tools
widgeboy's Avatar
Member with 43 posts.
 
Join Date: Jul 2006
Experience: Intermediate
02-Aug-2006, 09:16 AM #1
Solved: A quick COUNTIF solution
Hello tech wizards.

I have a problem that I am sure is simple to fix. Lets say I have a sheet with 2 columns, and 100 rows. Each of the cells are populated with the name of a fruit. What is the best way of counting the number of times that a certain situation occurs. For example, how many times in that data set, is there an "apple" in column A, and "pear" in column B. Can I use COUNTIF?
Yorkshire Guy's Avatar
Senior Member with 583 posts.
 
Join Date: Dec 2003
Location: Yorkshire, UK
02-Aug-2006, 10:02 AM #2
Hi Widgeboy,

Where do you want the counts, next to every occurence of say "Apple", or just once at the bottom of the list.

For the latter:
in a cell enter =COUNTIF(A1:A100,"Apples")
or =COUNTIF(B1:B5,"Pear")

For the former, entering =COUNTIF(A1:A100,A1) will count all the entries in col A that match what is in A1; copy this down the column.

lol
Hew
__________________
I use WinXP and Office2007
I may not respond straight away, I only use TSG ad-hoc
bomb #21's Avatar
Distinguished Member with 8,082 posts.
 
Join Date: Jul 2005
Location: The void AKA edge of the Fens
Experience: I bent my wookie :(
02-Aug-2006, 01:36 PM #3
Quote:
Originally Posted by widgeboy
Can I use COUNTIF?
Doubtful. There are various "Summing and Counting Using Multiple Criteria" examples at http://www.j-walk.com/ss/excel/tips/tip74.htm. The relevant one would be "Count of Sales where Month=Jan AND Region=North", so you'd end up with something like:

{=SUM((A1:A100="Apple")*(B1:B100="Pear"))}

(NB: you don't type the curly brackets, they're created when you use CTRL+Shift+Enter -- instead of plain Enter -- to enter the formula ; it's called an array formula).

OTOH, many folks these days use SUMPRODUCT to avoid using an array formula. Which would be something like:

=SUMPRODUCT((A1:A100="Apple")*(B1:B100="Pear"))
widgeboy's Avatar
Member with 43 posts.
 
Join Date: Jul 2006
Experience: Intermediate
07-Aug-2006, 11:42 AM #4
Thats great - thanks very much!! The second line is the best for me here.
Cheers.
carl schmitt's Avatar
Computer Specs
Junior Member with 1 posts.
 
Join Date: Mar 2008
Experience: Intermediate
21-Mar-2008, 02:26 PM #5
I tried formulas in # 21. Neither sumproduct nor sum yield a count- I get o (zero) each time

I am dealing with 2 ranges and trying to count the number of hits in each, given the other.

For example, trying to count the number that hve a 1-Large City in range AD2..Ad4629 while also having a Yes in range Bo2..bo4629.

Last edited by carl schmitt; 21-Mar-2008 at 02:29 PM.. Reason: added detail to help
jimr381's Avatar
Computer Specs
Senior Member with 4,183 posts.
 
Join Date: Jul 2007
Location: Vienna, VA
Experience: Computer Illiterate
21-Mar-2008, 02:57 PM #6
Welcome to the forum Carl. Have you looked into a pivottable before? It is usually a good idea to start your own thread as well to get more exposure.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:56 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.