+ Reply to Thread
Results 1 to 3 of 3

Can't add wildcards to index match

  1. #1
    Registered User
    Join Date
    06-15-2012
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    18

    Can't add wildcards to index match

    Hi all,

    I'm hoping some can help

    I am trying to do a two criteria index match in VBA.

    This works:

    result = [INDEX('Sheet1'!b:b,MATCH(1,(ah5='Sheet1'!A:A)*(x5='Sheet1'!B:B),0))]
    Range("bb5").Value = result



    But when I alter it to introduce wildcards into the second criteria it stops working.


    result = [INDEX('Sheet1'!b:b,MATCH(1,(ah5='Sheet1'!A:A)*("*" & x5 & "*" ='Sheet1'!B:B),0))]
    Range("bb5").Value = result

    By rights this should work. It's such a small issue but its taking up a lot of my time.

    Thanks in advance.

  2. #2
    Forum Contributor
    Join Date
    08-12-2020
    Location
    Atlanta, Georgia
    MS-Off Ver
    Office 16
    Posts
    241

    Re: Can't add wildcards to index match

    Try... result = [INDEX('Sheet1'!b:b,MATCH(1,(ah5='Sheet1'!A:A)*(""*"" & x5 & ""*"" ='Sheet1'!B:B),0))]
    Range("bb5").Value = result

    Squeaky

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Can't add wildcards to index match

    I would say that unless the asterisks are literal, e.g. "*apple*" is the value stored in Sheet1!b:b, this won't work - even if the syntax is fixed (c/o doubling up on the quotations)

    I suspect you will need to revert to a SEARCH based approach, e.g.:

    result = [INDEX('Sheet1'!b:b,MATCH(1,('sheet1'!a:a=ah5)*ISNUMBER(SEARCH(x5,'Sheet1'!b:b)),0))]

    edit: just realised this is quite an old post so OP will have hopefully resolved in the intervening period ;-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] problem using wildcards in INDEX / MATCH formula
    By edteitz in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-20-2019, 07:31 PM
  2. Using index, having trouble with wildcards
    By J.Anger in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-02-2018, 03:09 PM
  3. Replies: 6
    Last Post: 02-23-2018, 07:09 PM
  4. Using wildcards to get an exact match using vlookup or index and match
    By Martynw2005 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-15-2015, 09:56 PM
  5. [SOLVED] Index and Match with Wildcards
    By pytheus in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-23-2014, 08:43 PM
  6. [SOLVED] Make an Index/Match Sum Array with wildcards
    By TheAlchemyst in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-28-2014, 06:48 PM
  7. Wildcards with functions INDEX and EQUIV
    By Fabrice in forum Excel General
    Replies: 4
    Last Post: 07-15-2005, 11:05 AM

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