+ Reply to Thread
Results 1 to 4 of 4

Unable to use vlookup on a trimmed value

  1. #1
    Registered User
    Join Date
    05-25-2017
    Location
    Chicago
    MS-Off Ver
    Office 2016
    Posts
    31

    Unhappy Unable to use vlookup on a trimmed value

    Hello everyone,

    I'm in over my head and could really use some help.
    I'm trying to create an access-linked spreadsheet to indicate a network(field) change from one contract period to another. My data is in tabular form and refreshes as new info enters our database.

    Unfortunately, our ContractID is alphanumeric (begins with the letter D, the next 5 digits are the company's ID, and the last 4 are the year). To find the previous year's Network, I've trimmed the ContractID to remove the D in a separate column, then subtracted 1 from that value in a third column. I then run a vlookup to return the previous year's Network. Lastly, I have a formula to determine if the previous year's Network is different than the current year's.

    I'm sure there are better ways to do this, but my VBA skills are like the fine motor skills of a toddler.

    The issue I'm having is that the vlookup will not work against a trimmed value. I've learned that if I paste the value only, it will work. But because this needs to be actively linked to our Access database, I need it to update regularly without having to reformat the data every time.

    The spreadsheet I've attached is a slimmed down version (we work with thousands of records), but the formulas are exactly as they should be. There are two tables, one that is the current version, and one with a few values pasted in to demonstrate the results I'm looking for.

    Any help is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Unable to use vlookup on a trimmed value

    The RIGHT function returns a TEXT string, even if it appears to be numeric.

    Try adding +0 to all your right functions.
    =RIGHT(A2,9)+0

  3. #3
    Registered User
    Join Date
    05-25-2017
    Location
    Chicago
    MS-Off Ver
    Office 2016
    Posts
    31

    Re: Unable to use vlookup on a trimmed value

    Elegant and simple. This worked perfectly. Thank you!

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Unable to use vlookup on a trimmed value

    You're welcome.

+ 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. Getting a Vlookup to return a 'trimmed' value
    By TomP1988 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-22-2014, 05:39 AM
  2. Replies: 3
    Last Post: 11-08-2012, 07:25 PM
  3. [SOLVED] Trim and Keep the Trimmed Data
    By N Harkawat in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-06-2005, 06:05 PM
  4. [SOLVED] Trim and Keep the Trimmed Data
    By sally t in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  5. Trim and Keep the Trimmed Data
    By N Harkawat in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 11:05 AM
  6. Trim and Keep the Trimmed Data
    By sally t in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  7. [SOLVED] Trim and Keep the Trimmed Data
    By sally t in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-26-2005, 10:05 AM

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