+ Reply to Thread
Results 1 to 11 of 11

index match function vs index match vba type mismatch

  1. #1
    Registered User
    Join Date
    12-29-2021
    Location
    san francisco, ca
    MS-Off Ver
    excel 2016
    Posts
    5

    index match function vs index match vba type mismatch

    =INDEX('SGV OPC Codes'!B:B,MATCH(1,(Finished!D2='SGV OPC Codes'!C:C)*(Finished!E2='SGV OPC Codes'!D:D)*(Finished!H2='SGV OPC Codes'!H:H)*(Finished!I2='SGV OPC Codes'!E:E),0))
    the formula above works perfectly fine. but when I convert it to vba I am getting type mismatch.
    I have tried :

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    any idea?
    Attached Files Attached Files
    Last edited by AliGW; 02-10-2022 at 07:38 PM. Reason: Code tags added.

  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
    44,461

    Re: index match function vs index match vba type mismatch

    Where you have indexRng, maybe try indexRng.Address. Same for the other xxxRng variables.

    And perhaps change finWs.Range("D" & x) to finWs.Range("D" & x).Address.

    Just guesses, but something to try.


    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    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
    12-29-2021
    Location
    san francisco, ca
    MS-Off Ver
    excel 2016
    Posts
    5

    Re: index match function vs index match vba type mismatch

    sample file uploaded

  4. #4
    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
    44,461

    Re: index match function vs index match vba type mismatch

    Ok. Late now. I'll have a look tomorrow if no-one else has intervened and offered a solution.

  5. #5
    Registered User
    Join Date
    12-29-2021
    Location
    san francisco, ca
    MS-Off Ver
    excel 2016
    Posts
    5

    Re: index match function vs index match vba type mismatch

    Quote Originally Posted by TMS View Post
    Ok. Late now. I'll have a look tomorrow if no-one else has intervened and offered a solution.
    any luck with it?

  6. #6
    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
    44,461

    Re: index match function vs index match vba type mismatch

    Sorry, saw another similar thread and I thought it was this.

    I would be inclined to go with the formula you have rather than convert to VBA.

    Try this ... you end up with values anyway:

    Please Login or Register  to view this content.
    I was trying to make it quicker by not using full columns but, for some reason, it won't play. I'll have another look tomorrow.

  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
    44,461

    Re: index match function vs index match vba type mismatch

    OK, the code is a bit, alright, a lot longer, but it executes much more quickly.

    Please Login or Register  to view this content.

  8. #8
    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
    44,461

    Re: index match function vs index match vba type mismatch

    In reality, the Dynamic Named Ranges are static Named Ranges. However, they are dynamic in the sense that they will be updated every time the Change Event handler runs, so they will always reflect the current state.

  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
    44,461

    Re: index match function vs index match vba type mismatch

    Is this resolved now?

  10. #10
    Registered User
    Join Date
    12-29-2021
    Location
    san francisco, ca
    MS-Off Ver
    excel 2016
    Posts
    5

    Re: index match function vs index match vba type mismatch

    Quote Originally Posted by TMS View Post
    Is this resolved now?
    sorry for the late reply, it works great! thanks for the help!

  11. #11
    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
    44,461

    Re: index match function vs index match vba type mismatch

    You're welcome.


    An interesting challenge



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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] Index Match Type Mismatch Error
    By VBAJim in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-16-2019, 01:47 AM
  2. Index / match type problem, with partial string match
    By bkper087 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2019, 02:42 AM
  3. [SOLVED] Need help with Index Match or possibly array type of match
    By chadboehne in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-14-2017, 01:16 PM
  4. [SOLVED] VBA Index Match type function
    By Simon.xlsx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-03-2014, 04:07 AM
  5. [SOLVED] Need help with INDEX+MATCH type function
    By bxk006 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-09-2014, 11:39 AM
  6. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  7. Index and Match with Two Criteria, and date Match Type is Less Than
    By ExcelQuestion in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 11-11-2013, 08:57 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