+ Reply to Thread
Results 1 to 3 of 3

Vlookup on part of cell (numbers)

Hybrid View

kt1978 Vlookup on part of cell... 02-03-2011, 05:05 PM
NBVC Re: Vlookup on part of cell... 02-03-2011, 05:08 PM
kt1978 Re: Vlookup on part of cell... 02-03-2011, 06:31 PM
  1. #1
    Registered User
    Join Date
    11-15-2010
    Location
    Leicester
    MS-Off Ver
    Office 365
    Posts
    41

    Vlookup on part of cell (numbers)

    Hi all

    Having a problem with a vlookup involving part of the cells value..

    e.g. on my Names sheet I have info like
    89743 Name 1
    987232 Name 2

    On another sheet I want the lookup
    In this example A11 = 89743

    THIS WORKS FINE

    =IF(ISNA(VLOOKUP(A11,n_EmpList,1,0)),0,OFFSET(Names!$B$1,MATCH(A11,INDEX(n_EmpList,,1),0),-1))
    The reason I have to use the offset is just because of the way the data is imported, but that bit is fine.

    The problem is that the value in A11 = 189743 However I still want it to look up the value on the names sheet 89743.

    I thought this formula would work by just using the right() function.
    =IF(ISNA(VLOOKUP(RIGHT(A11,6),n_EmpList,1,0)),0,OFFSET(Names!$B$1,MATCH(RIGHT(A11,6),INDEX(n_EmpList,,1),0),-1))
    I presume this is because it is a number as it works fine if I test it with text.

    Any ideas???
    Last edited by NBVC; 02-03-2011 at 10:40 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup on part of cell (numbers)

    First, should it be the Right 5 digits?

    If so, try:

    =IF(ISNA(VLOOKUP(RIGHT(A11,5)+0,n_EmpList,1,0)),0,OFFSET(Names!$B$1,MATCH(RIGHT(A11,5),INDEX(n_EmpList,,1),0),-1))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    11-15-2010
    Location
    Leicester
    MS-Off Ver
    Office 365
    Posts
    41

    Re: Vlookup on part of cell (numbers)

    Hi

    Err, yes it should have been in that example.

    Your solution is spot on, Thank you.

    One thing I have changed is that sometimes the number is one less the length like so

    =IF(ISNA(VLOOKUP(RIGHT(A15,LEN(A15)-1)+0,n_EmpList,1,0)),0,OFFSET(Names!$B$1,MATCH(RIGHT(A15,LEN(A15)-1)+0,INDEX(n_EmpList,,1),0),-1))
    Another problem sorted

    Thanks again.

+ 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