[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# count if difficulties

Posted on 2011-10-06
Medium Priority
235 Views
I want to count if in Range A2:A5000 the cell does not contain any value from the range B2:B20

any thoughts?

Using excel 2007

-Brandon
0
Question by:KnutsonBM
• 3
• 2

LVL 50

Expert Comment

ID: 36926296
Hello Brandon,

Try this

SUMPRODUCT(--ISNA(MATCH(A2:A5000,B2:B20,0)))

That will coount all cells in the range A2:A5000 that don't match any value in B2:B20 - is that what you need?

regards, barry
0

LVL 50

Expert Comment

ID: 36926697
Of course you normally use an equals sign at the start, i.e.

=SUMPRODUCT(--ISNA(MATCH(A2:A5000,B2:B20,0)))

That formula will count blanks too, if you don't want that then modify like this

=SUMPRODUCT(ISNA(MATCH(A2:A5000,B2:B20,0))*(A2:A5000<>""))

barry
0

LVL 6

Author Comment

ID: 36926785
that will get to if it doesn't match, but i am looking for if it doesn't contain any value from B2:B20

say Cell B2 = V01.1

I want to count if the cells in range A2:A5000 do NOT contain that value

given the set below it would return 1

abc V01.1 defg
V01.1 abc defg
abc defg
0

LVL 6

Author Comment

ID: 36926796
capitalized the wrong word lol, do not CONTAIN that value
0

LVL 50

Accepted Solution

barry houdini earned 1000 total points
ID: 36926992
OK, can't help thinking there's an easier way....but this should do it

=SUM(IF(MMULT(ISNUMBER(SEARCH(TRANSPOSE(B2:B20),A2:A5000))+0,(ROW(B2:B20)^0)*(B2:B20<>""))=0,IF(A2:A5000<>"",1)))

confirmed with CTRL+SHIFT+ENTER

regards, barry
0

LVL 9

Assisted Solution

experts1 earned 1000 total points
ID: 36927433
To simplify the problem, I would do as follows:

(1) We add a new column range D2:D20 (This range shadows range B2:B20)

(2) Paste the formula below in D2 and copy it to range D3:D20

=IF(ISNUMBER(MATCH( B2,\$A\$2:\$A\$5000,0)),1,"")

Above formula will display "1" in any cell of range D2:D20 if the
corresponding cell row of range B2:B20 has a match in range A2:A5000

(3) In Range A:5002 or whichever cell you choose, enter the formula as below:

=IF(SUM(D2:D20)=0,COUNTIF(A2:A5000,"X"),"")

I used "X" as the criteria to COUNTIF, but use whatever..

Regards
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst youāll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to dā¦
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
###### Suggested Courses
Course of the Month19 days, 5 hours left to enroll