# Excel formula

#### doris.barrett

##### New Member
Need to check a range of cells = 4 or 5 and return the number of cells that meet the condition.
This message was edited by doris.barrett on 2002-09-20 11:16

### Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Use the "CountIf" function. JSW

You could use
=COUNTIF(yourrange,4)+COUNTIF(yourrange,5)

good luck

COUNTIF(range,criteria)
example: CountIf(A1:A40,4)

This is really nice expecially if you only need it to count if you have a reason but it counts by itself too

Example

=COUNTIF(C1:C9,4)+COUNTIF(C1:C9,5)

1. try countif =COUNTIF(A1:F4,4)+COUNTIF(A1:F4,5)

with criteria in G7 and G8
=COUNTIF(A1:F4,G7)+COUNTIF(A1:F4,G8)

or

2 SumProduct
=SUMPRODUCT((A3:F3={4;5})+0)
with criteria in G7:G8
=SUMPRODUCT((A3:F3=G7:G8)+0)
or
=SUMPRODUCT((C1:C4={4,5})+0)
or with criteria in G7:H7
=SUMPRODUCT((C1:C4=G7:H7)+0)

Dare I introduce one more way...
Book1
ABCDEFGHIJKL
1Field1Field1Thereare7ofthem
254
335
42
51
65
73
84
94
101
112
122
134
145
155
163
17
Sheet2

Replies
0
Views
206
Replies
3
Views
300
Replies
3
Views
208
Replies
8
Views
268
Replies
1
Views
149

1,221,525
Messages
6,160,328
Members
451,637
Latest member
hvp2262

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

### Which adblocker are you using?

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

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