+ Reply to Thread
Results 1 to 5 of 5

how do you omit part of a cell in a vlookup?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-14-2006
    Posts
    4

    Question how do you omit part of a cell in a vlookup?

    I need to find a code in a column on a sheet but some of the cells contain other text(comments) with the code. The Vlookup i've written wont pick up on those cells containing extra text.Is it possible to use vlookup to only look at the only 5 characters in a cell. Any help would be greatly appreciated on this one.

  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
    Hi,

    Your post is a bit vague. I've taking a stab at a possible solution but without a example of data and the return you expect it's a bit hard.

    I've assumed your looking for the first 5 characters.

    =VLOOKUP(LEFT(A1,5),C1:D5,2,FALSE)

    Post more info if this isn't what your after

    VBA Noob

  3. #3
    Registered User
    Join Date
    10-14-2006
    Posts
    4
    Hi

    Thanks for the reply. Will this formula work if the cells it searches might also contain additional text? For example
    A1 contains "3245 case open" and
    C2 contains "3245 case closed".
    I need for the formula to only look at the first few cells in both cells and produce a result. Sorry if this is not making much sense but i quite new to this

    Cheers

  4. #4
    Registered User
    Join Date
    10-14-2006
    Posts
    4
    Hi

    Thanks for the reply. Will this formula work if the cells it searches might also contain additional text? For example
    A1 contains "3245 case open" and
    C2 contains "3245 case closed".
    I need for the formula to only look at the first few cells in both cells and produce a result. Sorry if this is not making much sense but i quite new to this

    Cheers

  5. #5
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by BOK
    Hi

    Thanks for the reply. Will this formula work if the cells it searches might also contain additional text? For example
    A1 contains "3245 case open" and
    C2 contains "3245 case closed".
    I need for the formula to only look at the first few cells in both cells and produce a result. Sorry if this is not making much sense but i quite new to this

    Cheers
    You can take the formula supplied by VBA Noob to the next step from

    =VLOOKUP(LEFT(A1,5),C1:D5,2,FALSE)
    to
    =VLOOKUP(LEFT(A1,4),Left(C1:D5,4),2,FALSE)

    to suit your needs, but you need to press Ctrl/Shift/Enter to enter that formula which will then look like:

    {=VLOOKUP(LEFT(A1,4),Left(C1:D5,4),2,FALSE)}

    This will now look for 3245 and will reply with the first occurrance found.

    Hope this helps
    ---
    Si fractum non sit, noli id reficere.

+ 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