+ Reply to Thread
Results 1 to 5 of 5

Problem with Lookup text and numbers

  1. #1
    Registered User
    Join Date
    01-23-2008
    Location
    Bangkok, Thailand
    Posts
    3

    Problem with Lookup text and numbers

    Hello,
    I use the following formula, in Excel 2003, to lookup our product codes from a column:- =(LOOKUP(C7,Products!$A$3:$A$624,Products!$B$3:$B$624))*F7

    Most codes are 2 letters followed by 4 numbers, e.g. CH0104, no problem with this. However, some codes also have an additional letter at the end, e.g. CH0104L, in many (not all) instances adding a letter to the end returns an incorrect result. Has anyone experienced similar and know of any way around this?

    Thanks in advance.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    It you want to return the first 6 characters try

    Left(C7,6)

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    01-23-2008
    Location
    Bangkok, Thailand
    Posts
    3
    Quote Originally Posted by VBA Noob
    It you want to return the first 6 characters try

    Left(C7,6)

    VBA Noob
    Thanks for your reply.
    To clarify, Column A is a list of product codes, column B a list of the corresponding weights for each product. When a product code has a letter at the end of the code it is returning a value (weight) for a completely different product. It appears to be getting confused by the additional letter.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    The list of information to be looked through must be sorted in ascending order, otherwise errors will occur, either as #N/A or incorrect results.

    is this the case?

  5. #5
    Registered User
    Join Date
    01-23-2008
    Location
    Bangkok, Thailand
    Posts
    3
    Quote Originally Posted by arthurbr
    The list of information to be looked through must be sorted in ascending order, otherwise errors will occur, either as #N/A or incorrect results.

    is this the case?
    Thank you. First 6 characters were sorted but where a letter appeared at the end these were not always. e.g. CH0104S preceded CH0104L. All working fine now, 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