+ Reply to Thread
Results 1 to 3 of 3

Using VLookup with Left function

Hybrid View

  1. #1
    Registered User
    Join Date
    12-04-2008
    Location
    Birmingham, UK
    MS-Off Ver
    Office 2007
    Posts
    43

    Using VLookup with Left function

    I receive workbooks containing invoice information. One of the many taskes is to allocate costs to company and cost codes.

    I have attached a very simple example of what I am trying to do.

    I've created a two column range and called it Identifier. The first column is the number I look up and the second column is the number I want to return.

    The formulae I am using in B2 is:

    =VLOOKUP(LEFT(A2,1),Identifier,2,0)
    This should find the first character of the string in A2 look in column 1 of my table "Identifier" and return column 2.

    If the first character is an alpha character the formulae works, if it is a numeric digit it returns #N/A, so the problem is obviously with text versus number.

    Can anyone help with a solution?
    Attached Files Attached Files
    Last edited by dcaraher; 01-13-2011 at 12:32 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: Using VLookup with Left function

    You are looking up and using a mix of numbers and text/number strings...

    You have to convert all to text via Data|Text to columns, skipping to 3rd window and select Text, then Finish

    or change formula to:

    =VLOOKUP(IF(ISNUMBER(LEFT(A2,1)+0),LEFT(A2,1)+0,LEFT(A2,1)),Identifier,2,0)
    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
    12-04-2008
    Location
    Birmingham, UK
    MS-Off Ver
    Office 2007
    Posts
    43

    Re: Using VLookup with Left function

    Thank you NBVC, that works perfectly and saves me manipulating between data & text.

    Many Thanks

+ 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