?
Solved

Multi tier IF with Countif problem

Posted on 2011-09-19
6
Medium Priority
?
374 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
[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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

777 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