Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Count number of instances of a match in two cells

Posted on 2012-09-07
13
Medium Priority
?
519 Views
Last Modified: 2012-09-07
Hi Experts,

I want to count teh number of instances of a match in two cells for example:

Col A     Col B
Apple    in stock
Apple    in stock
Apple    out of stock
Pear      Out of stock

I want to count the numbers of apples+in stock=2
I think the answer is a sumproduct formula but I can't work out how to form it.

Thank you
0
Comment
Question by:wisemat
  • 7
  • 6
13 Comments
 
LVL 25

Expert Comment

by:lwadwell
ID: 38376043
try
=COUNTIFS(A:A,"Apple",B:B,"in stock")
0
 
LVL 25

Expert Comment

by:lwadwell
ID: 38376044
or if you really want sumproduct
=SUMPRODUCT((A:A="Apple")*(B:B="in stock"))
0
 

Author Comment

by:wisemat
ID: 38376101
Can this be applied accross worsheets?
I've attached an example

Thank you
example1.xls
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
LVL 25

Expert Comment

by:lwadwell
ID: 38376132
Sure can ... are you using Excel 2007 or higher?  countifs() was not available prior to 2007 I think.  I also added the sumproduct.

I added the fruit name column into the formula to show how it doesn't need to be hard coded.
example1.xls
0
 

Author Comment

by:wisemat
ID: 38376180
Im so sorry, this just doesnt seem to want to work for me.
(cleaned) relife example I'm working on.  can you take a look

The servers to be onboarded section in the first tab, I tried adapting both formulas and neither work.

A-ha just realised im on Excel 2003, does that mean im stuffed?

Thank you again
example2.xls
0
 
LVL 25

Accepted Solution

by:
lwadwell earned 2000 total points
ID: 38376213
sumproduct should work in 2003 ... I only have 2007 atm.  It looked fine to me, you didn't change the OS in the second formula.  I changed them to use the cell value for the OS.
example2.xls
0
 

Author Comment

by:wisemat
ID: 38376277
Im going to give you the points you have been brilliant and I can see in the example that it works.  

Unfortunatley it just wont work for my workbook.  However I dont want to publically post my office documents.

Thanks for the speedy help
0
 
LVL 25

Expert Comment

by:lwadwell
ID: 38376297
What is the problem you are having ... the formula errors, returns the wrong value ... ??
0
 

Author Comment

by:wisemat
ID: 38376343
just says #NUM
0
 

Author Comment

by:wisemat
ID: 38376365
It goes wrong as soon as I paste server names into column A of the TAS sheet, doesnt make sense to me
0
 

Author Comment

by:wisemat
ID: 38376383
Actually looking at it, to goes as soon as I take the filters off, when I put them back it stays broken, maybe 2003 issue?
0
 
LVL 25

Expert Comment

by:lwadwell
ID: 38376427
It could be something with 2003 and filters ... wish I had access to v2003 to test it myself.
0
 

Author Comment

by:wisemat
ID: 38376478
No problem, thanks
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question