+ Reply to Thread
Results 1 to 6 of 6

Identifying Last Word in a String (need function fix)

  1. #1
    Registered User
    Join Date
    10-17-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    71

    Identifying Last Word in a String (need function fix)

    I'm trying to identify if the last word in a string contains SCANNER. I have tried different code and posted a failed attempt below. Can anyone help fix this code?

    Please Login or Register  to view this content.
    SERVICE CHARGES
    SCAN HV MAINT
    LOW VOLUME SCANNER MAINT
    MED LOW VOLUME SCANNER

    If I have the above items, I only want to see TRUE for the MED LOW VOLUME SCANNER items, since SCANNER is the last word in the string. This will always be the case with my data. No other item ends with SCANNER and so I wan't to know when that string combination is true.

    Thanks in advance!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Identifying Last Word in a String (need function fix)

    Try

    =TRIM(RIGHT(SUBSTITUTE(TRIM(A1)," ",REPT(" ",LEN(A1))),LEN(A1)))="SCANNER"

  3. #3
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Identifying Last Word in a String (need function fix)

    =IF(ISERROR(FIND("SCANNER",RIGHT(TRIM(A1),8))),FALSE,TRUE)

    After trim function spacebar character is not deletiing, thus i used this function. Otherwise the function would be simpler
    Appreciate the help? CLICK *

  4. #4
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Identifying Last Word in a String (need function fix)

    Perhaps

    ="SCANNER"=RIGHT(TRIM(A1),7)
    Best regard, -)iger-/iger
    If you are pleased with a solution mark your post SOLVED.

  5. #5
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Identifying Last Word in a String (need function fix)

    Ok
    last character is not space bar. Its char(160)
    this function will work too

    =right(substitute(a1,char(160),""),7)="scanner"

  6. #6
    Registered User
    Join Date
    10-17-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: Identifying Last Word in a String (need function fix)

    Thanks guys, I got it solved! I used AZ-XL's answer above:

    Please Login or Register  to view this content.
    Works like a charm! I really appreciate all the help.

+ 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