+ Reply to Thread
Results 1 to 5 of 5

Return Value Based On Partial Text String

  1. #1
    Registered User
    Join Date
    05-27-2008
    Posts
    28

    Return Value Based On Partial Text String

    I'm trying to figure out how I can return a value based on the first 2 letters in a cell to the left of it. For example:

    Column A:
    APAWOEFIN
    MILCNAK123
    DEAFEAWAP
    MIAWEFNAP

    Column B (RESULT):
    APPLE
    MICROSOFT
    DELL
    MICROSOFT

    Logic: AP=APPLE, MI=MICROSOFT, DE=DELL. Tt can only look at the first 2 letters of the string or else the results will be off. Thoughts?
    Last edited by JonnyBoy333; 11-11-2011 at 04:55 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Return Value Based On Partial Text String

    If there are just three, this if formula will work just fine
    =IF(LEFT(A1,2)="MI","microsoft",IF(LEFT(A1,2)="AP","apple",IF(LEFT(A1,2)="DE","DeLL","")))

  3. #3
    Registered User
    Join Date
    05-27-2008
    Posts
    28

    Re: Return Value Based On Partial Text String

    And if there were, say 15?

  4. #4
    Registered User
    Join Date
    05-27-2008
    Posts
    28

    Re: Return Value Based On Partial Text String

    Sorry for the double post, I thought this formula would do the trick but it seems to be returning the wrong value sometimes. Like if more than one of the qualifiers is present in the text string it will return the result for the second qualifier instead of the first one that is the first 2 characters of the string, even though I put the LEFT({"AP","MI","DE"}, 2) in there. Any ideas?

    Please Login or Register  to view this content.
    Lol, ok I realized the LEFT() function has to be around the "A1" not the SEARCH() string. The correct function would be:

    Please Login or Register  to view this content.
    Solved.
    Last edited by JonnyBoy333; 11-11-2011 at 04:54 PM.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Return Value Based On Partial Text String

    Why would you not use my formula?
    Your formula only uses three as well.
    Here are three options
    One uses vlookup
    Attached Files Attached Files
    Last edited by davesexcel; 11-12-2011 at 09:52 AM.

+ 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