Count Values contained in a range

uk747

Well-known Member
Joined
Jul 20, 2011
Messages
832
Office Version
  1. 365
Platform
  1. Windows
Hi

I know you can coun text in a range using wildcards
is it possible with Values and a value in a cell reference

Want to know how to count how many times 123 appear in range below

and if 123 was in F2 how many times F2 appeared in range

123​
876​
5123​
41235​
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
something like this?
Book1
ABCDEF
1123count
287641123123123
35123
441235
5123123123
Sheet1
Cell Formulas
RangeFormula
C2C2=SUM(IFERROR(SEARCH("*123*",A1:A5),0))
D2D2=IF(SEARCH(123,F2),SUM(IFERROR(SEARCH(F2,A1:A5),0)),0)
 
Upvote 0
Thanks

=SUM(IFERROR(SEARCH("*123*",A1:A5),0)) Worked for hardcoded values

Tried =SUM(IFERROR(SEARCH(F2, A1:A5),0)) where F2 contained 123 and 123123123 was counted as 1, 41235 counted as 2 and 5123 counted as 2
 
Upvote 0
PS Also need it to count where the values in A2:A5 are text or numbers

e.g. If F2 has 123 and values in A2:A5 are below the result should be 4 because value in F2 which is 123 appears in 4 of the cells


123​
4123​
666​
6123d
41231234​
 
Upvote 0
Try ..
Excel Formula:
=COUNT(SEARCH(F2,A1:A5))
 
Upvote 0
Solution
Try ..
Excel Formula:
=COUNT(SEARCH(F2,A1:A5))
Thanks Peter a lot better than the one i eventually got(didn't realise there was a COUNT Function)
=SUM(IF(ISNUMBER(SEARCH(TEXT(F2, "0"), A1:A10)),1,0))
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

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
Back
Top