# Formula Question

#### ststern45

##### Well-known Member
Hi everyone,

Looking for a formula that will count if a number in a range of cells that will equal a number in another cell.

For example,

In cell A1 I have the number 6

In cell range A2:A5
A2= 3
A3= 6
A4= 6
A5= 0

In the example above the result would be 1 since there are 2 sixes in cells A3 and A4 that match the 6 in cell A1.

Example 2,

Cell B1 = 4
In cell range B2:B5
B2 = 4
B3 = 4
B4 = 4
B5 = 3

So the result would be 1 since a 4 appeared in cell range B2:B5

### Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

#### Tetra201

##### MrExcel MVP
Is this what you need?

=--(COUNTIF(A2:A5,A1)>0)

#### ststern45

##### Well-known Member
Yes
Thank you very much.
Works great!!

You are welcome.

Replies
13
Views
283
Replies
4
Views
174
Replies
6
Views
273
Replies
5
Views
263
Replies
1
Views
127

1,191,053
Messages
5,984,374
Members
439,883
Latest member
onions44

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