+ Reply to Thread
Results 1 to 3 of 3

Index/Match Left/Right With inconsistent string length/order

  1. #1
    Registered User
    Join Date
    08-25-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Index/Match Left/Right With inconsistent string length/order

    I would like to use INDEX/MATCH to look up values based on the combination of characters in a cell, but LEFT/RIGHT will not work because the length/order of characters is not consistent. Specifically:

    I have a set of scores for a competition which consist of up to 3 characters:

    A number (1-5), a modifier (+/-), and a category (A/B)

    For example:
    5+A
    3-B
    2-A

    The number is always present, but the modifier and/or category are often omitted..

    5A (no + or - in between)
    2+ (no category A/B)
    3 (no modifier or category)

    Note that there is NOT a blank space in place of omitted characters. A score of 5 is simply 5 (not 5[space][space]). (I tried using a placeholder for omitted characters but this resulted in a LOT of data entry errors when entering many scores rapidly).

    I would like to use INDEX/MATCH to look up values based on these scores in a table similar to the one below. Since the modifier and/or category may be omitted in any combination, I can't do a simple LEFT / RIGHT.

    Any suggestions for how to make this happen? I'm imagine there's an obvious solution right under my nose and I'm just overthinking...

    Thank you.


    Please Login or Register  to view this content.
    Last edited by Alabaster; 10-23-2010 at 04:14 PM.

  2. #2
    Registered User
    Join Date
    08-25-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Index/Match Left/Right With inconsistent string length/order

    I think I solved my own problem with a very simple (maybe obvious?) solution!

    In my lookup table, I simply created another column called ScoreID which concatenates "Score," "Mod," and "Cat" columns.

    I can index/match very simply based on the ScoreID rather than messing around with parsing my input and looking up 3 different columns of criteria.

    So far it seems to work. Am I overlooking any drawbacks or pitfalls that come with this solution?

    Thanks,
    chris.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Index/Match Left/Right With inconsistent string length/order

    you could join the index together so as not to have a helper if you wanted
    something like
    =INDEX($D$2:$F$14,MATCH($H$1,INDEX($A$2:$A$101&$B$2:$B$101&$C$2:$C$101,0),0),COLUMN(A1))
    but concatenating in a helper column is no bad thing and often is easier and understandable when you look back and try and remember hoe you did it!
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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