Solved

How do I include a substring search in an Excel 2010 COUNTIFS formula.

Posted on 2013-01-09
7
363 Views
Last Modified: 2013-01-09
Hi All,

I'm trying to include a text search as one of the criteria in an Excel COUNTIFS function.

If I have the following formula.......

=COUNTIFS($B:$B,$E3,$C:$C,F$2)

.....I want to replace F$2 with a search within the cell text for a specific substring.

For example, if cell F$2 contains the substring 'Error1' then the count will be incremented by 1.

I've attached a copy of my workbook.

Many thanks
Toco
Tests-and-Summary.xlsx
0
Comment
Question by:Tocogroup
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 23

Expert Comment

by:NBVC
ID: 38758906
Try with wildcards....

=COUNTIFS($B:$B,$E3,$C:$C,"*"&F$2&"*")
0
 
LVL 13

Expert Comment

by:Shanan212
ID: 38758908
=COUNTIFS($B:$B,$E3,$C:$C,"*Error1*")
0
 
LVL 24

Expert Comment

by:Steve
ID: 38758940
For multiple :

=SUM(COUNTIFS($B:$B,$E3,$C:$C,{"*Error1*","*Error2*"}))
(entereed with [ctrl]+[shift]+[enter])
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:Tocogroup
ID: 38759245
Thanks NB_VC. Your solution was the first.

One thing though, if I change the condition range from C:C to C2:C200, or to span TWO columns such as C:D then it returns a #VALUE error.

Any ideas ?
0
 
LVL 24

Expert Comment

by:Steve
ID: 38759274
You cannot span two columns for a single criteria range.

all criteria ranges should be the same size:
=COUNTIFS($B$2:$B$200,$E3,$C$2:$C$200,"*"&F$2&"*")
0
 
LVL 23

Accepted Solution

by:
NBVC earned 500 total points
ID: 38759359
If you want to span 2 columns, you can add 2 separate COUNTIFS together

=COUNTIFS($B$2:$B$200,$E3,$C$2:$C$200,"*"&F$2&"*") +COUNTIFS($B$2:$B$200,$E3,$D$2:$D$200,"*"&F$2&"*")

or use SUMPRODUCT like this:

=SUMPRODUCT(($B$2:$B$200=$E3)*(ISNUMBER(SEARCH(F$2,$C$2:$D$200))))
0
 

Author Closing Comment

by:Tocogroup
ID: 38759670
Many thanks NB_VC.
That was just the job.
Regards
Toco
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now