+ Reply to Thread
Results 1 to 9 of 9

Array Formula with Dynamic Wild Card Criteria

  1. #1
    Registered User
    Join Date
    12-29-2010
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Array Formula with Dynamic Wild Card Criteria

    Hi All,

    I have been searching, reading, and trying to figure out how to make this formula:

    =SUM((MONTH('SHEET1'!$K$2:$K$145)=$C$46)*(YEAR('SHEET1'!$K$2:$K$145)=$B$45)*('SHEET1'!$F$2:$F$145=B78))+SUM((MONTH('SHEET3'!$K$2:$K$145)=$C$46)*(YEAR('SHEET3'!$K$2:$K$145)=$B$45)*('SHEET3'!$F$2:$F$145=B78))

    (which works) work the way I want which would (if it worked which it doesn't) would be:

    =SUM((MONTH('SHEET1'!$K$2:$K$145)=$C$46)*(YEAR('SHEET1'!$K$2:$K$145)=$B$45)*('SHEET1'!$F$2:$F$145="*"&B78&"*"))+SUM((MONTH('SHEET3'!$K$2:$K$145)=$C$46)*(YEAR('SHEET3'!$K$2:$K$145)=$B$45)*('SHEET3'!$F$2:$F$145="*"&B78&"*"))

    The difference is that the reference to:

    B78

    would be a wild card match versus an exact match

    "*"&B78&"*"

    Any recommendations to how I can make this work would be great.

    I've tried concatenation inline, in an external cell, using SEARCH, using ISNUMBER(FIND(, and a few other things.

    Note - B78 is a string, it is not a number.

    Thanks,

    Michael

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: Array Forumla with Dynamic Wild Card Criteria

    Can you upload example and state what you trying to do?

  3. #3
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Array Forumla with Dynamic Wild Card Criteria

    have you tried ((len('SHEET1'!$F$2:$F$145)-len(substitute('SHEET1'!$F$2:$F$145,b78,"")))>0)

    to replace

    ('SHEET1'!$F$2:$F$145="* "&B78&"*")
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  4. #4
    Registered User
    Join Date
    12-29-2010
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Array Forumla with Dynamic Wild Card Criteria

    Attached is an anonymous sheet.

    Quote Originally Posted by zbor View Post
    Can you upload example and state what you trying to do?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-29-2010
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Array Forumla with Dynamic Wild Card Criteria

    Quote Originally Posted by squiggler47 View Post
    have you tried ((len('SHEET1'!$F$2:$F$145)-len(substitute('SHEET1'!$F$2:$F$145,b78,"")))>0)

    to replace

    ('SHEET1'!$F$2:$F$145="* "&B78&"*")
    I'll give it a shot and see what happens.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Array Forumla with Dynamic Wild Card Criteria

    The standard approach would be to use ISNUMBER(SEARCH, e.g.

    =SUM((MONTH('SHEET1'!$K$2:$K$145)=$C$46)*(YEAR('SHEET1'!$K$2:$K$145)=$B$45)*ISNUMBER( SEARCH(B78,'SHEET1'!$F$2:$F$145)))

    SEARCH isn't case-sensitive - if you want case-sensitivity switch to FIND

    In Excel 2010 you could use COUNTIFS with a wildcard....

    =COUNTIFS('SHEET1'!$K$2:$K$145,">="&DATE($B$45,$C$46,1),'SHEET1'!$K$2:$K$145,"<="&EOMONTH( DATE($B$45,$C$46,1),0),'SHEET1'!$F$2:$F$145,"*"&B78&"*")
    Last edited by daddylonglegs; 12-29-2010 at 06:30 PM.
    Audere est facere

  7. #7
    Registered User
    Join Date
    12-29-2010
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Array Forumla with Dynamic Wild Card Criteria

    Quote Originally Posted by daddylonglegs View Post
    The standard approach would be to use ISNUMBER(SEARCH, e.g.

    =SUM((MONTH('SHEET1'!$K$2:$K$145)=$C$46)*(YEAR('SHEET1'!$K$2:$K$145)=$B$45)*ISNUMBER( SEARCH(B78,'SHEET1'!$F$2:$F$145)))

    SEARCH isn't case-sensitive - if you want case-sensitivity switch to FIND

    In Excel 2010 you could use COUNTIFS with a wildcard....

    =COUNTIFS('SHEET1'!$K$2:$K$145,">="&DATE($B$45,$C$46,1),'SHEET1'!$K$2:$K$145,"<="&EOMONTH( DATE($B$45,$C$46,1),0),'SHEET1'!$F$2:$F$145,"*"&B78&"*")
    The ISNUMBER worked perfect. Not sure why I had it wrong before, but it's working fine now.

    Thank You,

    Michael

  8. #8
    Registered User
    Join Date
    12-30-2010
    Location
    Usa
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Array Formula with Dynamic Wild Card Criteria

    Hi..Trying for the Array Forumla with Dynamic Wild Card Criteria

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Array Formula with Dynamic Wild Card Criteria

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

    Hello peterandrew,

    please start your own thread if you can't find the answer for your specific query. Try to give as much relevant detail as possible, thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1