Count Cells Containing specific number, when cell contains multiple numbers

Dom10

New Member
Joined
Jan 4, 2021
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Is it possible to count the number of instances of a specific number in a cell, if the cell has multiple, comma separated numbers in it.

Eg: 1,19,20

I tried using =COUNTIF(A$2:A$4,"*"&C2&"*")+COUNTIF(A$2:A$4,C2)

but is appears to count 11 as 1, if there is other content in the cell. It also could not distinguish between 112,1 and 11,1.... it would count both of these as 11.
1609775719410.png


Any ideas, greatly appreciated.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the forum!

Try:

Book2
ABCD
1ListNumberCount
211,1,511
311,421
44,1131
51143
63,451
72,11115
Sheet3
Cell Formulas
RangeFormula
D2:D7D2=SUMPRODUCT(--ISNUMBER(FIND(","&C2&",",","&$A$2:$A$7&",")))
 
Upvote 0
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
+Fluff v2.xlsm
ABCD
1
211,1,511
311,421
44,1131
51143
63,451
72,11115
8
Master
Cell Formulas
RangeFormula
D2:D7D2=SUMPRODUCT(--(ISNUMBER(FIND(","&C2&",",","&$A$2:$A$7&","))))
 
Upvote 0
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
+Fluff v2.xlsm
ABCD
1
211,1,511
311,421
44,1131
51143
63,451
72,11115
8
Master
Cell Formulas
RangeFormula
D2:D7D2=SUMPRODUCT(--(ISNUMBER(FIND(","&C2&",",","&$A$2:$A$7&","))))
Thanks.
Details updated as follows:
Microsoft Excel for Office 365 MSO (16.0.12527.21378) 32-bit
 
Upvote 0
Welcome to the forum!

Try:

Book2
ABCD
1ListNumberCount
211,1,511
311,421
44,1131
51143
63,451
72,11115
Sheet3
Cell Formulas
RangeFormula
D2:D7D2=SUMPRODUCT(--ISNUMBER(FIND(","&C2&",",","&$A$2:$A$7&",")))
Thanks! That does the trick.

However, seeing as I can't really decipher what that formula is doing, I wonder if you can help me my second element. Perhaps I should have asked the question all in one go, but I thought I would be able to use COUNTIFS for this second part (however, I cannot see how that would work using the SUMPRODUCT formula you suggested).

Once I have identified which Items are related to which Serial Number, I then want to see how many are Completed. The Status column either has proposed date or Completed.

1609809820311.png
 
Upvote 0
Try:

Book1
ABCDEFG
1ItemListStatusSerial NumberCount% Completed
2A12,1,5Completed1540%
3B1Completed2333%
4C2,112/1/2021310%
5D1,22/15/2021410%
6E3,4,13/15/202151100%
7F11,2Completed111100%
Sheet1
Cell Formulas
RangeFormula
F2:F7F2=SUMPRODUCT(--ISNUMBER(FIND(","&E2&",",","&$B$2:$B$7&",")))
G2:G7G2=SUMPRODUCT(--ISNUMBER(FIND(","&E2&",",","&$B$2:$B$7&",")),--($C$2:$C$7="Completed"))/F2
 
Upvote 0
Try:

Book1
ABCDEFG
1ItemListStatusSerial NumberCount% Completed
2A12,1,5Completed1540%
3B1Completed2333%
4C2,112/1/2021310%
5D1,22/15/2021410%
6E3,4,13/15/202151100%
7F11,2Completed111100%
Sheet1
Cell Formulas
RangeFormula
F2:F7F2=SUMPRODUCT(--ISNUMBER(FIND(","&E2&",",","&$B$2:$B$7&",")))
G2:G7G2=SUMPRODUCT(--ISNUMBER(FIND(","&E2&",",","&$B$2:$B$7&",")),--($C$2:$C$7="Completed"))/F2
Oh my! That is excellent. Thank you so much. That is so elegant. Thanks so much for sharing your knowledge.
 
Upvote 0
Excel for Office 365
In that case, some alternatives:

21 01 05.xlsm
ABCDEFG
1ItemListStatusSerial NumberCount% Completed
2A12,1,5Completed1540.0%
3B1Completed2333.3%
4C2,11/12/2021310.0%
5D1,215/02/2021410.0%
6E3,4,115/03/202151100.0%
7F11,2Completed111100.0%
Completed
Cell Formulas
RangeFormula
F2:F7F2=COUNT(FIND(","&E2&",",","&B$2:B$7&","))
G2:G7G2=COUNT(FILTER(F$2:F$7,(C$2:C$7="Completed")*ISNUMBER(FIND(","&E2&",",","&B$2:B$7&",")),""))/F2
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,547
Members
449,089
Latest member
davidcom

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