Consulting

Results 1 to 11 of 11

Thread: Wildcard with match index

  1. #1
    VBAX Regular
    Joined
    Jun 2017
    Posts
    26
    Location

    Wildcard with match index

    Hi All,

    {=IF(Y12 = "Diamond_Round",INDEX(F11:F88,MATCH(W12,B11:B88,1)),"")}

    I am using the formula above successfully.

    However I want to find any of the following text options in the place of Diamond_Round.
    "Diamond_Round"
    "Diamond_Oval"
    "Diamond_Princess"
    "Diamond_Marquise"
    etc.

    I've read about wildcards and have tried the following with no success.

    {=IF(Y12 = "Diamond_*",INDEX(F11:F88,MATCH(W12,B11:B88,1)),"")}
    {=IF(Y12 = "*Diamond_*",INDEX(F11:F88,MATCH(W12,B11:B88,1)),"")}
    {=IF(Y12 = "Diamond_????????",INDEX(F11:F88,MATCH(W12,B11:B88,1)),"")}


    I've attached a sample. The formula in question is in AA12.
    Thanks in advance to anyone who has suggestions.

    Jill
    Attached Files Attached Files

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    It's had to test since all of the data seems to link to a file on Jill's Desktop, but try the LEFT() below

    "=IF('C:\Users\Jill\Desktop\Dataport\SampleData\[Solitaire.3dm.xls]Sheet1'!D3="Gem 01", 'C:\Users\Jill\Desktop\Dataport\SampleData\[Solitaire.3dm.xls]Sheet1'!E3)"


    =IF(LEFT(Y12,7)="Diamond",INDEX(F11:F88,MATCH(W12,B11:B88,1)),"")
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Regular
    Joined
    Jun 2017
    Posts
    26
    Location
    Thanks Paul that worked!

  4. #4
    VBAX Regular
    Joined
    Jun 2017
    Posts
    26
    Location
    I'm attaching a sheet where I am using this formula but not getting the expected results. The sheet is quite complex (I'm new to excel scripting so please excuse my Frankenstein approach to the solution).

    To use the sheet please follow these steps.
    1. First go to developer tab and run the macro "Sheet1.Gem"
    2. View the tab titled "Scratch"

    Note the result in AO = .005 The results should be .006
    I'm not exactly sure whats happening. Any ideas? Thanks in advance to anyone who takes a look.

    ~Jill
    Attached Files Attached Files

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    They all look like FALSE or #VALUE to me after I run the macro.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Regular
    Joined
    Jun 2017
    Posts
    26
    Location
    I'm attaching another version.
    Attached Files Attached Files

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Looks the same to me.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    I think you need to introduce data that you know will produce results and work through to the breakdown. There are so many False results, it's hard to follow what is going on
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  9. #9
    VBAX Regular
    Joined
    Jun 2017
    Posts
    26
    Location
    The attached sheet should have data that shows the error.

    I opened the file from this thread on another computer. I had to do the following;

    1. enable editing in excel
    2. go to the developer tab and choose Macro Security (under Code). Then choose "Enable all macros".
    3. Click Macro and choose Sheet1.Gem, Run

    The unexpected results are the worksheet titled "Scratch" in AO 14. The value in the sheet is .005. I would expect it to be .006. It should have done an index match for a 1.1x1.1x.68mm and located the .006 in T15.

  10. #10
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Set your Match parameter to 0 rather than 1 for an exact match
    If you use the Formulas/Evaluate Formulas tool you will see that your formula returns a Match value of 21
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  11. #11
    VBAX Regular
    Joined
    Jun 2017
    Posts
    26
    Location
    Rookie mistake.

    Thanks for the help.

    Blushing,
    Jill

Posting Permissions

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