• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Multi tier IF with Countif problem

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
1 Solution
Haris DjulicCommented:
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";" ")))
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.
BMCISAdminAuthor Commented:
Still giving me invalid error.
Independent Software Vendors: 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!

barry houdiniCommented:
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

BMCISAdminAuthor Commented:
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.
barry houdiniCommented:
In your formula if the second IF...


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


regards, barry


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now