+ Reply to Thread
Results 1 to 12 of 12

Lookup by deleting last character/Digit

  1. #1
    Registered User
    Join Date
    08-11-2012
    Location
    Bangalore
    MS-Off Ver
    Office 365
    Posts
    16

    Lookup by deleting last character/Digit

    Hi Team,

    I am looking for Vlookup formula by removing last digit of the value till we get the result.

    Example

    I have to vlookup for "Apple" if there is error or no result then formula should check for "Appl" then "App".."Ap".
    I can use "LEN" but not sure how to reduce by 1 char everytime if there is no result. As the character or len of the value is not fixed so i can't fix the formula using if error as i may end with long formula and it may still need manual check on lenght.

    Thanks in Advance
    Last edited by ravichandavar; 06-11-2019 at 11:25 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Lookup by deleting last character/Digit

    It would help if you attached a sample Excel workbook.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Pete

  3. #3
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Lookup by deleting last character/Digit

    I've got monster like this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    accept with Ctrl+Shift+Enter (not just Enter).

    and in attached file works (if I correctly understand issue. very interesting by the way).
    Attached Files Attached Files
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  4. #4
    Registered User
    Join Date
    08-11-2012
    Location
    Bangalore
    MS-Off Ver
    Office 365
    Posts
    16

    Post Re: Lookup by deleting last character/Digit

    I think it was not clear. Attached file should clear the doubt.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-11-2012
    Location
    Bangalore
    MS-Off Ver
    Office 365
    Posts
    16

    Re: Lookup by deleting last character/Digit

    Pete_UK please find the attachment
    KOKOSEK your attachment is not working if i change the value. Please have look on my attachment. I would like to fix the automated lookup till last digit of the Value with some formula as the LEN of the required data is not fix always

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Lookup by deleting last character/Digit

    Please try at G2
    =INDEX(C:C,LOOKUP(9^9,MATCH(LEFT(F2,ROW(A$1:INDEX(A:A,LEN(F2))))&"*",B:B,)))

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Lookup by deleting last character/Digit

    Or this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  8. #8
    Registered User
    Join Date
    08-11-2012
    Location
    Bangalore
    MS-Off Ver
    Office 365
    Posts
    16

    Post Re: Lookup by deleting last character/Digit

    Thanks Bo_Ry . But there is issue with the formula. I think i have fixed this with below formula;

    =IFERROR(VLOOKUP(F2,B:C,2,0),REPT(VLOOKUP(LEFT(F2,(LEN(F2)-1)),B:C,2,0),(LEN(F2)-(LEN(F2)-1))))

    But still i need some experts like you to validate. Also attached file with both the formulas with difference.

    Thanks,
    Attached Files Attached Files
    Last edited by ravichandavar; 06-11-2019 at 02:38 PM.

  9. #9
    Registered User
    Join Date
    08-11-2012
    Location
    Bangalore
    MS-Off Ver
    Office 365
    Posts
    16

    Re: Lookup by deleting last character/Digit

    Sorry I was wrong

    =IFERROR(VLOOKUP(F2,B:C,2,0),REPT(VLOOKUP(LEFT(F2,(LEN(F2)-1)),B:C,2,0),(LEN(F2)-(LEN(F2)-1)))) XXXXXXXXXXXXX Doesn't work.

    Thanks Alkey & Bo_Ry you are right its working fine.

    Thanks once again for Quick help.

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Lookup by deleting last character/Digit

    How about

    =INDEX(C:C,LOOKUP(9^9,MATCH(LEFT(F2,ROW(A$1:INDEX(A:A,LEN(F2)))),B:B,)))

  11. #11
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Lookup by deleting last character/Digit

    Quote Originally Posted by ravichandavar View Post
    KOKOSEK your attachment is not working
    Mine solution, looking for whole word and then automatically cut off last character to find out first X characters, then cut off next 'last' etc.
    AND it works properly.
    Check this attachment.
    EDIT: I've found a problem with my formula. Bo_Ry got the same idea but creates much, much simpler.
    Last edited by KOKOSEK; 06-11-2019 at 12:27 PM.

  12. #12
    Registered User
    Join Date
    08-11-2012
    Location
    Bangalore
    MS-Off Ver
    Office 365
    Posts
    16

    Re: Lookup by deleting last character/Digit

    Hi Bo_Ry,

    Just want to understand the formula. specifically LOOKUP(9^9 & ROW(A$1:INDEX(A:A

    It is working fine but i just want to understand it as well.

    Thanks,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VlookUp a 3 digit character and return the value to the right
    By Eduards in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-30-2019, 10:22 AM
  2. [SOLVED] Removing a digit or character from a cell
    By GigG in forum Excel General
    Replies: 20
    Last Post: 10-23-2018, 02:23 PM
  3. [SOLVED] Pulling a 10 digit character that begins with a B - Formula help!
    By keith81591 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 08-27-2018, 03:01 PM
  4. Space after every 4th Number in a 16 digit Character Set
    By Flipback in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-30-2014, 01:20 AM
  5. Adding cells if they contain specific character/digit
    By happynoodleboy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-23-2013, 07:05 AM
  6. how to remove all the spaces behind the last character/digit
    By ttik in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2007, 11:07 PM

Tags for this Thread

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