View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default SUMIF Wild Card formula for two words in cell

Hi Howard,

Am Fri, 13 Feb 2015 11:53:14 -0800 (PST) schrieb L. Howard:

I suppose one could expand to three...?


if you have 3 A the formula takes it as correct because AAA contains AA.

Try it with a UDF:

Function mySum(myRng As Range) As Double
Dim varData As Variant
Dim i As Long

varData = myRng
For i = 1 To UBound(varData)
If InStr(varData(i, 1), "AA") And InStr(varData(i, 1), "CC") Then
mySum = mySum + varData(i, 2)
End If
Next
End Function

And call this function in the sheet with
=mySum(E1:F7)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional