counting wrong?

excelNewbie22

Well-known Member
Joined
Aug 4, 2021
Messages
510
Office Version
  1. 365
Platform
  1. Windows
hi,
i have two lists, list a and list b
i want to check each cell in list b against all list a to check if there's repeats
but for some reason it doesn't work
why is that?
also, is it a problem list a shorter then list b for this formula? cause when the formula get to c12 it checks against empty cells

testtttttt.xlsx
ABC
1list alist brepeats
211-3-4-8-411-3-4-8-40
314-1-15-1-111-3-4-4-80
42-8-2-12-1111-3-8-4-40
53-3-14-1-1411-4-3-8-40
65-9-2-4-311-4-3-4-80
72-1-5-5-1011-4-8-3-40
811-4-3-4-811-4-8-4-30
93-4-8-4-1111-4-4-3-80
102-1-4-5-2111-4-4-8-30
1111-8-3-4-40
1211-8-4-3-40
1311-8-4-4-30
143-11-4-8-40
153-11-4-4-80
163-11-8-4-40
173-4-11-8-40
183-4-11-4-80
193-4-8-11-40
203-4-8-4-11-
213-4-4-11-80
test
Cell Formulas
RangeFormula
C2:C21C2=IF(COUNTIF($A$1:A1,B2)=0,IF(COUNTIF($A$2:$A$10,B2)=1,0,COUNTIF($A$2:$A$10,B2)),"-")
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
=countif($A$2:$A$10,B2)
and copy down

Book1
ABCD
1list alist brepeats
211-3-4-8-411-3-4-8-401
314-1-15-1-111-3-4-4-800
42-8-2-12-1111-3-8-4-400
53-3-14-1-1411-4-3-8-400
65-9-2-4-311-4-3-4-801
72-1-5-5-1011-4-8-3-400
811-4-3-4-811-4-8-4-300
93-4-8-4-1111-4-4-3-800
102-1-4-5-2111-4-4-8-300
1111-8-3-4-400
1211-8-4-3-400
1311-8-4-4-300
143-11-4-8-400
153-11-4-4-800
163-11-8-4-400
173-4-11-8-400
183-4-11-4-800
193-4-8-11-400
203-4-8-4-11-1
213-4-4-11-800
Sheet1
Cell Formulas
RangeFormula
C2:C21C2=IF(COUNTIF($A$1:A1,B2)=0,IF(COUNTIF($A$2:$A$10,B2)=1,0,COUNTIF($A$2:$A$10,B2)),"-")
D2:D21D2=COUNTIF($A$2:$A$10,B2)
 
Upvote 0
thank you
but what if there will be duplicates in list b?
won't it count it twice?

edit:
also, i need to know mostly if and how many it repeats more then once
sorry not to mention it sonner
 
Upvote 0
can you show some examples of what you mean please,

with examples of expected results
 
Upvote 0
i think the problem is when i have two identicals in list b
see d10 vs e10

testtttttt.xlsx
ABCDE
1list alist brepeatsexpected resultsCOUNTIF($A$2:$A$10,B2)
211-3-4-8-411-3-4-8-4011
33-4-8-4-1111-3-4-4-8000
42-8-2-12-1111-3-8-4-4000
511-4-8-4-311-4-3-8-4000
65-9-2-4-311-4-3-4-8011
72-1-5-5-1011-4-8-3-4000
811-4-3-4-811-4-8-4-3-11
93-4-8-4-1111-4-4-3-8000
102-1-4-5-2111-4-8-4-3--1
1111-8-3-4-4000
1211-8-4-3-4000
1311-8-4-4-3000
143-11-4-8-4000
153-11-4-4-8000
163-11-8-4-4000
173-4-11-8-4000
183-4-11-4-8000
193-4-8-11-4000
203-4-8-4-11-22
213-4-4-11-8000
test
Cell Formulas
RangeFormula
C2:C21C2=IF(COUNTIF($A$1:A1,B2)=0,IF(COUNTIF($A$2:$A$10,B2)=1,0,COUNTIF($A$2:$A$10,B2)),"-")
E2:E21E2=COUNTIF($A$2:$A$10,B2)
 
Upvote 0
how about
=IF(COUNTIF($B$2:B2,B2)>1,"-",COUNTIF($A$2:$A$10,B2))

Book3
ABCDEF
1list alist brepeatsexpected resultsCOUNTIF($A$2:$A$10,B2)
211-3-4-8-411-3-4-8-40111
33-4-8-4-1111-3-4-4-80000
42-8-2-12-1111-3-8-4-40000
511-4-8-4-311-4-3-8-40000
65-9-2-4-311-4-3-4-80111
72-1-5-5-1011-4-8-3-40000
811-4-3-4-811-4-8-4-3-111
93-4-8-4-1111-4-4-3-80000
102-1-4-5-2111-4-8-4-3--1-
1111-8-3-4-40000
1211-8-4-3-40000
1311-8-4-4-30000
143-11-4-8-40000
153-11-4-4-80000
163-11-8-4-40000
173-4-11-8-40000
183-4-11-4-80000
193-4-8-11-40000
203-4-8-4-11-222
213-4-4-11-80000
Sheet1
Cell Formulas
RangeFormula
E2:E21E2=COUNTIF($A$2:$A$10,B2)
F2:F21F2=IF(COUNTIF($B$2:B2,B2)>1,"-",COUNTIF($A$2:$A$10,B2))
C2:C21C2=IF(COUNTIF($A$1:A1,B2)=0,IF(COUNTIF($A$2:$A$10,B2)=1,0,COUNTIF($A$2:$A$10,B2)),"-")
 
Upvote 0
Solution

Forum statistics

Threads
1,214,918
Messages
6,122,243
Members
449,075
Latest member
staticfluids

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