Conditional Counting using worksheet function..

allanTeh

New Member
Joined
Jun 29, 2006
Messages
43
I have 2 Columns A and B with following values:

Values in Cells A2 to A11 are:
1.30
1.35
1.31
1.41
1.40
1.31
1.41
1.30
1.40
1.35

Values in Cells B2 to B11 are:
4
4
3
4
4
4
3
2
2
1

The result I need is :

If range in Column A (A2 to A11) = 1.31 to 1.40,
count the NO OF CELLS in Column B (B2 to B11) where the value = 4.

QUESTION: How to use worksheet function to do it?

(The correct answer should be 3)
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Try this:
Code:
=SUMPRODUCT(--(A1:A10<=1.4),--(A1:A10>=1.31),--(B1:B10=4))
 

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,169
Office Version
  1. 2013
Platform
  1. Windows
Try:

=SUMPRODUCT(--(A1:A10<1.5),--(A1:A10>1.30),--(B1:B10=4))
 

allanTeh

New Member
Joined
Jun 29, 2006
Messages
43
BOTH answers given above NOT working !!

Is it because cell format have to be of certain type to make the answer given SUMPRODUCT to work?
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
With the possible exception of numbers formatted as text, no.

But you should adjust for your actual range:
=SUMPRODUCT(--(A2:A11<=1.4),--(A2:A11>=1.31),--(B2:B11=4))

Note however that you can't use entire columns with SUMPRODUCT.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,816
Messages
5,855,797
Members
431,764
Latest member
scottishbigyin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top