Solved

Multi tier IF with Countif problem

Posted on 2011-09-19
6
353 Views
Last Modified: 2012-05-12
I am working on an advancement template for Cub Scout Leaders similar to Trax but for a single scout that follows the scout through the entire program.  This is proving to challenge my Excel skills to their limits.  I am on the Bear Rank page and I have a few acheivements that say do requirement a and j + any 2 others.  During testing I found that the formulas that I setup are not really doing what they are suppose to.  Current formula for the example I gave is: =IF(AND(COUNTIF(I7:I14,"A")=2,I6="A",I15="A"),"C",IF(COUNTIF(I7:I14,"A")>=3,"C",IF(COUNTIF(I6:I15,"A")>0,"P"," ")))  I tried changing it to =IF(AND(COUNTIF(I7:I14,"A")=2,AND(I6="A"),AND(I15="A")),"C",IF(COUNTIF(I7:I14,"A")>=3,"C",IF(COUNTIF(I6:I15,"A")>0,"P"," "))) but it throws me an invalid formula error.  Not sure where I have gone wrong.  I will add your name to the credits if you share your info. Cub-History-1.xlsx
0
Comment
Question by:BMCISAdmin
6 Comments
 
LVL 15

Expert Comment

by:Haris Djulic
ID: 36560515
just replaced the commas with semi-comma and it gave me no error .. can you test if is it working ..

=IF(AND(COUNTIF(I7:I14;"A")=2;AND(I6="A");AND(I15="A"));"C";IF(COUNTIF(I7:I14;"A")>=3;"C";IF(COUNTIF(I6:I15;"A")>0;"P";" ")))
0
 
LVL 8

Expert Comment

by:ragnarok89
ID: 36560566
I think the problem is that your range "BearRank" is not made from a contiguous block of cells.

Wolfrank is  Wolf!$D$3:$D$15
It includes ALL cells from row 3 to 15. This is Good

BearRank is Bear!$C$9:$C$10,Bear!$C$12:$C$16,Bear!$C$18:$C$23,Bear!$C$25:$C$35
doeas NOT include all cells from row 9 to 35, this is bad.
0
 

Author Comment

by:BMCISAdmin
ID: 36560690
Still giving me invalid error.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 50

Expert Comment

by:barry houdini
ID: 36560715
Hello BMCISAdmin,

=IF(AND(COUNTIF(I7:I14,"A")=2,I6="A",I15="A"),"C",IF(COUNTIF(I7:I14,"A")>=3,"C",IF(COUNTIF(I6:I15,"A")>0,"P"," ")))

That looks better than your second attempt - you don't need to use multiple ANDS.....

Can you explain what you want the formula to do in words? Can you describe a pattern of values in I6:I15 where you don't get the result you want using the formula above?Don't forget that with nested IFs the later IFs are only evaluated when the other tests fail, e.g. you'll only get a "P" if that specific condition is satisfied (at least one "A" in I6:I15) but the previous two are not.

regards, barry


0
 

Author Comment

by:BMCISAdmin
ID: 36560779
barryhoudini For this particular achievement the scout has to complete requirement a nd j, I6 and I15, and any 2 other requirements, I7:I14.  The problem is that on the side of the bear page where this formula is I have a mini-dashboard that gives a status for each achievement and where the scout is in earning his rank.  Right now with the current formula if you put an A on requirement a throug d it marks the achievement with a C rather than keeping it a P since requirement J has not been marked with an A.
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 36560850
In your formula if the second IF...

IF(COUNTIF(I7:I14,"A")>=3

....is true if there are 3 "A"s or more in I7:I14, that doesn't care about I6 and I15. If the stipulation is that you need I6 and I15 to be "A"s and at least 2 others then remove that 2nd IF and use just

=IF(AND(COUNTIF(I7:I14,"A")>=2,I6="A",I15="A"),"C",IF(COUNTIF(I6:I15,"A")>0,"P",""))

regards, barry




0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

776 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