+ Reply to Thread
Results 1 to 5 of 5

The value in vlookup array has spaces but the lookup value does not

  1. #1
    Registered User
    Join Date
    12-19-2020
    Location
    Turkey
    MS-Off Ver
    2019
    Posts
    19

    The value in vlookup array has spaces but the lookup value does not

    Hi All,

    I have a formula which uses VLOOKUP function. The lookup array I use for this formula has some text values in it which starts with some space. An example would be " Hello" instead of "Hello". However, my lookup value is just "Hello" and hence the vlookup formula does not work. I do not want to just type in the text for the lookup value as I want to copy the formula down. Trim and substitute functions come to mind but I could not manage to get them to work. The formula is pasted below. The formula might seem a bit daunting but in essence it is just a vlookup formula.

    Any ideas? Thanks in advance


    Formula: copy to clipboard
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,260

    Re: The value in vlookup array has spaces but the lookup value does not

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    You could try TRIM() around the lookup array.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: The value in vlookup array has spaces but the lookup value does not

    It is NOT a good idea to wraap the array in TRIM, this will FORCE the formula to look at all 1,000,000+++ rows, instead of stopping at the first match.

    Also, your formula looks a bit messy. Try:

    =LOOKUP("*"&$B8,INDIRECT("'"&$C$2&"'!A:AA"),2+COLUMNS($B$8:B$8),FALSE)

    You'll need ; and not ,
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    12-19-2020
    Location
    Turkey
    MS-Off Ver
    2019
    Posts
    19

    Re: The value in vlookup array has spaces but the lookup value does not

    Applying trim to the lookup array did work. However, it simply slowed the process way down, which, I'm guessing is what Glenn was talking about. The formula with the LOOKUP function did not work either though. It just returns the "too many arguments" error. The reason why I used MATCH and ABS is to count the number of columns after copying the formula to the right of the row by the way.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,260

    Re: The value in vlookup array has spaces but the lookup value does not

    Provide a sample workbook, please.

+ 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. Use vlookup to lookup part of the lookup value in the array
    By pluginguin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2022, 10:13 AM
  2. VLOOKUP with ARRAY lookup value in an Array HELP
    By CWever in forum Excel General
    Replies: 11
    Last Post: 07-10-2019, 04:01 PM
  3. IF with Vlookup and OR? Multiple Lookup Value with Single Array
    By kelvin156 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-09-2018, 08:19 AM
  4. Replies: 4
    Last Post: 04-25-2017, 11:01 AM
  5. Replies: 1
    Last Post: 11-19-2014, 03:09 PM
  6. LOOKUP or VLOOKUP within CSE array (2007)
    By JayUSA in forum Excel General
    Replies: 1
    Last Post: 06-22-2009, 10:49 PM
  7. Using Vlookup to lookup array, return array
    By jcampbell in forum Excel General
    Replies: 5
    Last Post: 11-16-2007, 01:13 PM

Tags for this Thread

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