+ Reply to Thread
Results 1 to 13 of 13

MAXIF and MINIF functions with wildcards

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    NORWICH , ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    16

    MAXIF and MINIF functions with wildcards

    Hi
    I have a list of bank transactions in a spreadsheet
    for example....

    1/7/09 Sainsburys Petrol 34856385
    4/7/09 Paypal 92017465
    6/7/09 Sainsburys S/Market 38264059
    8/7/09 Halfords 93862830
    11/7/09 Sainsburys S/Market 34957372
    13/7/09 Paypal 92037454
    14/7/09 Barclays BCC 173256

    and wish to use formulae similar to MAXIF and MINIF to find the last date and the first date of Paypal transactions (for example) if I have just the word "Paypal" in cell D1

    I've tried
    =SUMPRODUCT(MAX(($B$1:$B$7=$D$1)*$A$1:$A$7))

    but obviously this is looking for exact match of "Paypal"

    I have successfully used a wildcard in SUMIF functions elsewhere...

    eg, $D$1 & "*"

    but for some reason
    =SUMPRODUCT(MAX(($B$1:$B$7=$D$1 & "*")*$A$1:$A$7))
    does not work

    Does anyone have any suggestions?
    TIA
    Joojohn
    Last edited by JOOJOHN; 07-16-2009 at 02:48 PM.

  2. #2
    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: MAXIF and MINIF functions with wildcards

    =MAX((LEN(SUBSTITUTE(LOWER(B5:B6),"paypal",""))<>LEN(B5:B6))*C5:C6)

    would work for MAX, min is a little more involved!

    =MIN(($C$5:$C$8+(1.1E+300*(LEN(SUBSTITUTE(LOWER($B$5:$B$8),"paypal",""))=LEN($B$5:$B$8)))))

    both confirmed with CSE
    Last edited by squiggler47; 07-16-2009 at 01:30 PM.
    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!


  3. #3
    Registered User
    Join Date
    01-26-2009
    Location
    NORWICH , ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: MAXIF and MINIF functions with wildcards

    Doesnt seem to be working

    in your example, does B5:B6 and C5:C6 correspond to my list?
    where B5:B6 is B1:B7
    and C5:C6 is A1:A7

    A B
    1 1/7/09 Sainsburys Petrol 34856385
    2 4/7/09 Paypal 92017465
    3 6/7/09 Sainsburys S/Market 38264059
    4 8/7/09 Halfords 93862830
    5 11/7/09 Sainsburys S/Market 34957372
    6 13/7/09 Paypal 92037454
    7 14/7/09 Barclays BCC 173256

  4. #4
    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: MAXIF and MINIF functions with wildcards

    Yes, but did you confirm the formulas with Ctrl-Shift-Enter?

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: MAXIF and MINIF functions with wildcards

    First Date

    =MIN(IF(ISNUMBER(SEARCH($D$1,$B$1:$B$7)),$A$1:$A$7))
    committed with CTRL + SHIFT + ENTER

    for Last Date as above but switch MIN to MAX

  6. #6
    Registered User
    Join Date
    01-26-2009
    Location
    NORWICH , ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: MAXIF and MINIF functions with wildcards

    thanks for those,

    squiggler, your max formula will only work for numerical text (tried it with a cheque number)

    DonkeyOte, your max formula works perfectly thanks! but the min formula will only return the first date in the list
    eg 1/7/09 rather than 4/7/09

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: MAXIF and MINIF functions with wildcards

    Quote Originally Posted by JOOJOHN View Post
    DonkeyOte, your max formula works perfectly thanks! but the min formula will only return the first date in the list
    eg 1/7/09 rather than 4/7/09
    Only if you have a transaction containing Paypal in B that is dated 1st July, based on your sample data it will return 4th July.

    Did you confirm both MAX & MIN as Arrays with CTRL + SHIFT + ENTER

    Might be an idea to post a sample file with formulae in place.

  8. #8
    Registered User
    Join Date
    01-26-2009
    Location
    NORWICH , ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: MAXIF and MINIF functions with wildcards

    heres a cut down version of my sheet
    Last edited by JOOJOHN; 07-16-2009 at 02:46 PM.

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: MAXIF and MINIF functions with wildcards

    Your MIN functions are referencing C and not B and C is blank.

    Given C is blank it will simply return the MIN date of the entire range given the SEARCH will return a number for each row in the array.

  10. #10
    Registered User
    Join Date
    01-26-2009
    Location
    NORWICH , ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: MAXIF and MINIF functions with wildcards

    Oh yeah, schoolboy error there, I dragged the formula right to do the MIN function without locking to Column B, thanks!

  11. #11
    Registered User
    Join Date
    01-26-2009
    Location
    NORWICH , ENGLAND
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: MAXIF and MINIF functions with wildcards

    Just one more question...
    I am using
    {=MIN(IF(ISNUMBER(SEARCH($D$1,$B$1:$B$7)),$A$1:$A$7))}
    and
    {=MAX(IF(ISNUMBER(SEARCH($D$1,$B$1:$B$7)),$A$1:$A$7))}
    but how can I only return a max or min value if the text in D1 is found only in the first position of a cell by the search function
    eg,
    {=MIN(IF((SEARCH($D$1,$B$1:$B$7)=1),$A$1:$A$7))}
    have tried this with no luck

    (all array entered)

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: MAXIF and MINIF functions with wildcards

    =MAX(IF(ISNUMBER(SEARCH(D1,$B$1:$B$25))*SEARCH(D1,$B$1:$B$25)=1,$A$1:$A$25))
    works(array entered)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: MAXIF and MINIF functions with wildcards

    For the MIN value where column B begins with the value in D1 You can use LEFT function, i.e.

    =MIN(IF(LEFT($B$1:$B$7,LEN($D$1))=$D$1&"",$A$1:$A$7))

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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