+ Reply to Thread
Results 1 to 13 of 13

VLOOKUP using wildcard on non-static data

  1. #1
    Registered User
    Join Date
    03-09-2012
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2007
    Posts
    11

    VLOOKUP using wildcard on non-static data

    I'm wondering if there is a way to perform a VLOOKUP function on data that isn't always an exact match - possibly using a wildcard feature? We have a report that shows errors on accounts that need to be worked daily. Based on the type of error, determines which department is responsible for working the error. Many times, these errors have dates in them, as well as different charge codes. The other tricky thing is that the Error description field does not always have these non-static data elements in the same location....they are scattered throughout the description. I have a table that I am referencing, that lists all of the errors, and which department is responsible. Obviously, my table will not have every possible charge code and date in it, so it can't find a match. Any help will be GREATLY appreciated!
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP using wildcard on non-static data

    Your sample sheet does not include a mockup of your desired results. Show us your end goal based on that sample data.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-09-2012
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VLOOKUP using wildcard on non-static data

    I am trying to perform a VLOOKUP in column I, against the Error Table on the next tab. As you can see, my vlookup didn't return any data because there was no exact matches. I forgot that the sample I sent you I had overwritten the VLOOKUP statment and just manually typed in the responsible department. Sorry about that.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP using wildcard on non-static data

    Put this array formula in J5 and confirm by pressing Ctrl-Shift-Enter to activate the array:

    =IF(OR(ISNUMBER(SEARCH('Error Table'!$A$3:$A$150, $H5))),'Error Table'!$B$3:$B$150)

    You'll know the array is active when "HIM" appears and you see curly braces { } around the formula. Now copy that cell downward.

  5. #5
    Registered User
    Join Date
    03-09-2012
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VLOOKUP using wildcard on non-static data

    That worked on a few of them, but the ones that say "Invalid date on date ....", it returns FALSE. I have attached the new updated file to show what I mean.
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP using wildcard on non-static data

    Yeah, blow that off. Use this in J5 and copy down (non-array):

    =LOOKUP(2,1/ISNUMBER(SEARCH('Error Table'!$A$2:$A$114,H5)),'Error Table'!$B$2:$B$114)



    If you want to see WHERE the matches occurred, put this in L5 and copy down, it will give you the row number:

    =LOOKUP(2,1/ISNUMBER(SEARCH('Error Table'!$A$2:$A$114,H5)),ROW('Error Table'!$B$2:$B$114))

  7. #7
    Registered User
    Join Date
    03-09-2012
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VLOOKUP using wildcard on non-static data

    I don't understand what the above formula is actually doing, but is there not a way to use a wildcard? When I typed that into my spreadsheet, it worked on a few of the errors, but not all. Thanks!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP using wildcard on non-static data

    The SEARCH function is a wildcard function, that's why we used it. On your sheet posted the formula(s) above worked for all items.

    If you have a different set of test data, post that and we'll see what's wrong.

  9. #9
    Registered User
    Join Date
    03-09-2012
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VLOOKUP using wildcard on non-static data

    I have updated my schedule, so that you can see all of the errors that weren't able to return the correct value.
    Attached Files Attached Files

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP using wildcard on non-static data

    I'm confused, you think those items SHOULD match? I sorted the ERROR TABLE to make it easier to scan visually, and I don't see matches for any of those items. What am I missing?


    On the other hand, you have all these entries on your ERROR TABLE:

    Please Login or Register  to view this content.
    Those could all be replaced by a single item:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-09-2012
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VLOOKUP using wildcard on non-static data

    This was my original question...is there a way to perform a vlookup function that utilizes a wildcard, so that if the edit descriptions were slightly different each day, it would still be able to determine which department should work it. Are you saying that in my Error table, if I have several of the same error, as long as I replace the changing pieces to a "*", my lookup function would work?

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP using wildcard on non-static data

    yes, I was able to edit your ERROR TABLE to add wildcards in to get MANY of those codes to ring true.

    The only issue is things like your items:
    Please Login or Register  to view this content.

    All those have DIFFERENT Resp Dept, so you'll have to work that out. Maybe the Pharmacy codes all start with J? And LAB codes all start with 8?

  13. #13
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP using wildcard on non-static data

    Also watch for errant "spaces" in your ERROR table, that was affecting some others.

+ 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