# Conditional Counting using worksheet function..

#### allanTeh

##### New Member
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
Try this:
Code:
=SUMPRODUCT(--(A1:A10<=1.4),--(A1:A10>=1.31),--(B1:B10=4))

#### ADAMC

##### Well-known Member
Try:

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

#### allanTeh

##### New Member
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
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.

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.

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

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