• LinkedIn
  • YouTube
  • Twitter
  • Facebook
  • Google+

Basing an Excel formula on two conditions

by on
in Admin Pro Forum

Question: “I need help writing an Excel formula that counts information from two columns. I want the result to be the total number of items that meet two conditions.

Example: Imagine a spreadsheet where Column A records location and Column B records a number. I want to calculate how many entries for Location Such-and-Such also have a number in Column B that is less than 15 [=COUNTIF(B1:B25,”<15”]. How would I write that formula?”  -- Valerie


“I came up with the following solution using array formulas. These are special formulas because they act on a range of data called an array.


“The SUM function is used because COUNTIF doesn’t work for this. If you notice, we are multiplying two logical values above. If the first condition in array A is met, then the value is one; otherwise, it is zero. For the second condition in array B, if it is met, the value is one; otherwise, it is zero. So, we raise the SUM by one each time both conditions are met; otherwise, there is no change in the SUM. This turns the SUM command into a counter.

“Array formulas are entered into cells with Control, Shift, Enter, rather than the Enter key alone. Excel will add the curly brackets {} to show that it’s an array formula. If you forget to do that, simply highlight the formula in the formula entry bar and press Control Shift Enter. Don’t type the curly brackets yourself.”

“If I’m understanding your question correctly, the following formula should do what you’re asking.

=IF(B2:B22<15, 1,0)
This is an ‘If Then” statement to determine if column B is < 15 (yes or no, where 1 = YES and 0 = NO).

=IF(C2:C22>0, SUM(C2:C22), “ “)
This is an ‘If Then’ statement to tally the number of cells in column C that are <15 in the selected data range.”

Like what you've read? ...Republish it and share great business tips!

Attention: Readers, Publishers, Editors, Bloggers, Media, Webmasters and more...

We believe great content should be read and passed around. After all, knowledge IS power. And good business can become great with the right information at their fingertips. If you'd like to share any of the insightful articles on BusinessManagementDaily.com, you may republish or syndicate it without charge.

The only thing we ask is that you keep the article exactly as it was written and formatted. You also need to include an attribution statement and link to the article.

" This information is proudly provided by Business Management Daily.com: http://www.businessmanagementdaily.com/15413/basing-an-excel-formula-on-two-conditions "

Leave a Comment