+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : Recognizing Text in and IF statement

  1. #1
    Registered User
    Join Date
    05-30-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007
    Posts
    29

    Recognizing Text in and IF statement

    I am trying to write an IF statment that will recognize a single alpha character and return the first 5 characters. Here are the two types of data in the file:

    JM7185
    JM7186
    JM7189P
    JM7190P


    Here is my formula:

    =IF(E28<>"P",RIGHT(E28,5),RIGHT(E28,4))

    I want the formula to look at the cell and recognize the "P" at the end. If it sees a P, then return the first 5 characters to the right and the first 4 if it doesn't see the P.

    Any help on this would be greatly appreciated.

    Juanita

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Recognizing Text in and IF statement

    You mean like:

    =IF(RIGHT(E28,1)="P",RIGHT(E28,5),LEFT(E28,4))

  3. #3
    Registered User
    Join Date
    05-30-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Recognizing Text in and IF statement

    Almost. But that helped a great deal.

    =IF(RIGHT(E28,1)="P",RIGHT(E28,5),RIGHT(E28,4)) Worked Perfectly.

    Thank you very much!

+ 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