?
Solved

Excel Count Multiple Conditions

Posted on 2013-05-22
6
Medium Priority
?
345 Views
Last Modified: 2013-05-23
Good morning,
I have the following table:

A                   B         C         D           E                 F
Equipment   Time   Time   Time  Running       Issues?
A                    4        5         4         Yes               Yes
A                    5        0         0         Yes                Yes
A                    6        0         5         Yes                Yes
A                    0        5         4         Yes                No
B                    0        0         0          No                No
C                    4        4         4         Yes                 Yes
C                    4        4         5          Yes                No
C                    3        4         3          Yes                 Yes
C                    10        4        2          Yes                 No

I need the following separate functions:
1. If there are more than 2 "Yes" in "Issues" per Running Equipment, don't count Equipment.
Answer should be "0".  

2. Number of Running Equipment that has more than 2 "Yes" in "Issues".
Answer should be "1".

3. Number of Running Equipment with criteria : Column 5<=C<="G2"  OR Column 1<=D<"G3"
Each row counted only once.
If I assigned G2 = 10 and G3 = 3, Answer should be "2".

Both should ignore errors and blanks.

Thank you!
0
Comment
Question by:crepe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 8

Expert Comment

by:agillanders
ID: 39188994
I'm sorry but I cannot work out what you want from your description.

1. You describe some criteria but your provided 'answer' doesn't make sense. A meets the criteria, B and C do not. What are you counting to get a 0 answer?

2. No problem

3. Column 1 is the equipment label (text) and column 5 is Running (boolean) neither of which can be compared to a numeric with any sensible result. I presume your intention is some relationship between the A, B, C columns with a 'cap' provided by the additional input cells?

None of it looks difficult - but your requirements are ambiguous at best.

Alistair
0
 

Author Comment

by:crepe
ID: 39189306
1. I'm sorry. I forgot to clarify. For 1. I want to count the number of Equipments that have Issues during the Run. I have a Countif that counts if there is a "Yes" under "Issues" but I don't want to count equipments that have more than 2 Yes's under Issues. So my original Countif will have "5" but I only want "2" from the 2 Yes's with Equipment C and to ignore the "3" Yes's with Equipment A.

3. I was not clear for my requirement for 3. I shouldn't have put in "Column" before the range. I only want to count rows that are within a range in Column C and D. So I meant Column C if it's between 5 and 10 and Column D if it's between 1 and 3.

Thank you for your quick response!
0
 
LVL 8

Accepted Solution

by:
agillanders earned 2000 total points
ID: 39189670
OK

There are two approaches.
Use Excel formulas with hidden intermediate values.
Use VBA macros

For a variety of reasons I strongly prefer the former. See the attached demo using that approach (in normal use the highlighted columns would be hidden and they can be extended to cover many more entries). Also this approach means the order of the table does not matter.

Basically you have criteria that are specific to an individual equipment. So you need a two step solution. Find the values for each equipment, then count the totals from there.

Alistair
SelCount.xlsx
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:crepe
ID: 39191307
Good morning,

When you break it down like that, it makes more sense. I was trying to do everything in one cell when it is a lot easier to break it down the way you did it.
Thank you.
0
 
LVL 8

Expert Comment

by:agillanders
ID: 39192597
Yeah. It is a standard tactic that makes for MUCH easier understanding when you come back in six months and try and understand what you did. Or worse if someone else has to figure it out. Excel's computation engine is very fast and there is very rarely any real benefit from force-fitting everything into a complex single cell formula. That's mostly an ego trip for the guru's rather than pragmatic development.:-)

In this case I don't believe it is possible without VBA. It could be a little more compact but really there is no need. It becomes self-explanatory.

Please remember to accept the solution.

Alistair
0
 

Author Closing Comment

by:crepe
ID: 39192705
Thank you!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

764 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