LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default SUMIF Wild Card formula for two words in cell

Hi Howard,

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

It just occurred to me that one could use cell references to write the BB CC etc. to the UDF as a variable.


then you have to enlarge the declaration.

But here a more reliable UDF for a string with 3 times 2 characters.
If you write the first substring in A1 and the second in A2 then call
the UDF with:
=mysum(E1:F7;A1;A2)

Function mySum(myRng As Range, str1 As Range, _
str2 As Range) As Double
Dim varData As Variant
Dim n As Long
Dim myStr As String

varData = myRng
For n = 1 To UBound(varData)
myStr = Replace(Replace(varData(n, 1), str1, ""), str2, "")
If Len(Trim(myStr)) = 2 Then
mySum = mySum + varData(n, 2)
End If
Next
End Function



Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wild card in formula Greg Snidow Excel Programming 7 October 15th 08 08:53 PM
wild card?? formula question please ferde Excel Discussion (Misc queries) 6 October 11th 08 01:40 PM
Using wild card in IF formula gcukarski Excel Discussion (Misc queries) 3 September 19th 08 12:22 AM
Wild Card for SUMIF criteria Ronbo Excel Worksheet Functions 2 December 12th 07 09:09 PM
wild card -- help with formula Michael A Excel Discussion (Misc queries) 10 January 8th 06 10:15 AM


All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"