You are here:

- Home
- Computing/Technology
- Business Software
- Excel
- formula syntax

Advertisement

QUESTION: Hi Tom

I have just reviewed the question that I asked of you earlier and realised that it is unclear. Please accept my apologies for the confusion.

It should have read:

I have written the following formula.

=if(and(c2<9,g2<9,countif(b2:ai2,"<9")=4),countif(b2:ai2,"<16)

It is trying to calculate the following:

If "C2 is less than 9 and G2 is less than 9 and the amount of scores less than 9 between B2 and Ai2 is exactly 4 then count the amount of scores between B2 and Ai2 that is less than 16.

There is something wrong with the syntax. Could you help me with this please?

Thanks in advance.

Chris M

ANSWER: Christopher Mitchell,

=if(and(c2<9,g2<9,countif(b2:ai2,"<9")=4),countif(b2:ai2,"<16"),"")

if you want to display FALSE when the conditions are not met, then you can just do

=if(and(c2<9,g2<9,countif(b2:ai2,"<9")=4),countif(b2:ai2,"<16"))

So hopefully that gives you what you want.

--

Regards,

Tom Ogilvy

---------- FOLLOW-UP ----------

QUESTION: Hi Tom

I have a range of cells A2:S2. Cell C2 contains "8" and cell G2 contains "7", Cells H2 and i2 contain 5 and 6 respectively. Cell J2:M2 contain the number "10"

I wrote the following formula in cell "W2".

=IF(AND(C2<9,G2<9,COUNTIF(B2:S2,"<9")=4),COUNTIF(B2:S2,"<16"),"")

I had expected the formula to return the number "8".

This is because the number in C2 and G2 is less than nine; there are exactly four numbers between B2 and S2 that are less than "9" and there is a total of "8" numbers that are less than "16".

Could you point out where I have gone wrong?

Thanks in advance

Chris

Chris,

You formula returned 8 for me. I opened a new workbook and duplicated in the cells specified the numbers you stated. I copied your formula and put it in W2. It produced 8.

if it isn't returning 8 for you, then I would look at the other cells that are empty for me.

--

Regards,

Tom Ogilvy

- Add to this Answer
- Ask a Question

Rating(1-10) | Knowledgeability = 10 | Clarity of Response = 10 | Politeness = 10 |

Comment | Thank you. I will investigate further. |

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

Answers by Expert:

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Extensive experience. **Education/Credentials**

Master of Science (MS) degree Operations Research (ORSA)**Awards and Honors**

Microsoft MVP in Excel.