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

Multi tier IF with Countif problem

Posted on 2011-09-19
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
Question by:BMCISAdmin
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";" ")))

Expert Comment

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.

Author Comment

ID: 36560690
Still giving me invalid error.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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


Author Comment

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

Accepted Solution

barry houdini earned 500 total points
ID: 36560850
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

809 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