We help IT Professionals succeed at work.
Get Started

SUMIF help

mark_harris231
on
432 Views
Last Modified: 2012-08-14
Looking for some help with a SUMIF formula

Given:
A               B
--------------
This         10
That        11
Or           15
The         20
Other     25

I have a formula that counts the number of times a string (H2) appears within a range (using the CTRL+SHIFT+ENTER array formula):

{=IF(H2<>"",SUM(IF(ISNUMBER(SEARCH("*"&H2&"*",A:A)),1,0)),"")}

This works fine.  If I enter "the" in H2, it returns a count of 2 (cells A4 & A5 contain this string).  A search value of "th" returns a count of 4 (A1, A2, A4 & A5).

What I'm looking for help with is a related formula.  I want to sum the values found in column B if a cell is included in the count above.  So, for the first example - a search value of "the" would return a sum of 45 (20+25).  A search of "th" would return a sum of 66 (10+11+20+25).

I tried the following, but I'm guessing the syntax isn't correct:
{=SUMIF($A$2:$A$250000,ISNUMBER(SEARCH("*"&H2&"*",A:A))&"=TRUE",$B$2:$B$250000)}

I'd prefer not to use VBA if possible, but can if that's the only way.
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2013
Commented:
This problem has been solved!
Unlock 2 Answers and 23 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE