+ Reply to Thread
Results 1 to 9 of 9

Match with Muliple Criteria VBA Syntax Issue

  1. #1
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    98

    Match with Muliple Criteria VBA Syntax Issue

    I'm struggling to convert this worksheet formula into Vba code.

    =INDEX(A2:A15,MATCH(1,("X"=D2:D10)*("Y"=C2:C10),0))

    The Vba error sound has beaten my eardrums and i need backup

    Thanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,368

    Re: Match with Muliple Criteria VBA Syntax Issue

    That's an array formula so you would need something like:

    Please Login or Register  to view this content.

    or:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    98

    Re: Match with Muliple Criteria VBA Syntax Issue

    Ah Ok Ill try this,

    Thanks

  4. #4
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    98

    Re: Match with Muliple Criteria VBA Syntax Issue

    The problem im having is that X and Y are variables and as i am unfamiliar with arrayformula's in vba im
    having more syntax issues

    dim i as string, j as string

    i = "X"
    j = "Y"

    Selection.FormulaArray = _
    "=INDEX(A2:A15,MATCH(1,(j=D2:D10)*(i=C2:C10),0))"

    How can i get the above working

    Thanks,

  5. #5
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    98

    Re: Match with Muliple Criteria VBA Syntax Issue

    Ooh i think i worked it out

    i need to break up the quotes with the & symbol and bring in the variables that way.

    Think i'm sorted

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Match with Muliple Criteria VBA Syntax Issue

    I reckon
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,368

    Re: Match with Muliple Criteria VBA Syntax Issue

    Untested, but I think you'd get away with:

    Please Login or Register  to view this content.

    Regards, TMS

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Match with Muliple Criteria VBA Syntax Issue

    you need the quotes in the formula unless those are named ranges

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,368

    Re: Match with Muliple Criteria VBA Syntax Issue

    @JP: there was going to be a long answer but I think you're probably right.

+ 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