+ Reply to Thread
Results 1 to 5 of 5

How does vlookup parse a "numeric character" argument

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    How does vlookup parse a "numeric character" argument

    When you vlookup("1"... things get interesting. I devised a very very easy to follow example which shows my question/dilemma. 30 seconds tops for you to reproduce it
    In A1 Type the 3 characters "1" and hit enter
    In B1 Type the number 1 and hit enter
    Copy A1 to A3.

    B3=vlookup(a3,$a$1:$b$1,2,false)
    B4=vlookup("1",$a$1:$b$1,2,false)

    For fun, guess which ones succeed on the lookup, and which ones don't. Then read further.

    B4 fails. No, it's not coercing a number from the argument, because if you copy B1 to A1, it still fails. B3 works.

    Can anyone explain how things are being parsed/interpreted?

    Now how about this: if you change A1 to
    '1
    would B4 work?

    Here's another test for you: what happens when you type
    ="1"
    in A1. Will B4 work then? I'll bet not everyone guessed those right. Pretty funky, huh?

    Thanks if you can explain how things are being parsed/interpreted?

    P.S. And I just have to say this: almost without fail (on OTHER boards, not THIS one ), whenever I post a confusing problem like this, that ought to be simple but apparently isn't, and someone is unable to actually answer, they get frustrated and feel compelled to explain that what I'm trying to do is ludicrous, or chastise that vlookup is supposed to be used for numeric lookups, etc. However I know that YOU are going to really explain what is happening here, and we'll all sing Kumbaya Or maybe it's just the simplest question in the world and I'm the only one who doesn't see it!
    Last edited by Oppressed1; 07-10-2017 at 06:29 PM. Reason: typo fix at end
    Chip, if you can read this, you're STILL making the world a better place with your immeasurably valuable gifts. Every week, you continue to help me (and untold numbers of others) tremendously. Practically no alternative outlets can match your effectiveness, even over the vast number of topics you demystify and empower usage of. You were, and still are, amazing.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,837

    Re: How does vlookup parse a "numeric character" argument

    I am not sure I understand. It seems to make sense to me:

    When I enter "1" into a cell, the cell contains that entire text string "1". This is different from the 1 text string, which is different from the number 1. In the VLOOKUP() formula, because " " is used to designate a text string argument (everything in between the quotes is text), the B4 version of the vLOOKUP() is searching for the text string 1, which is different from the text string "1". I am not sure how to get the VLOOKUP() to include the double quote characters in the search string, but I seem to recall seeing others use the CONCATENATE() function or operator to do this. For example, try =VLOOKUP(CONCATENATE(CHAR(34),1,CHAR(34)),A1:B1,2,FALSE) in B5.

    Perhaps the confusion is around when is Excel using the double quote character as a text literal and when is it using the double quote character to identify that what is in between the double quote is a text string.

    Does that help?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: How does vlookup parse a "numeric character" argument

    I think that's a well developed answer. Works for me!

  4. #4
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: How does vlookup parse a "numeric character" argument

    In this case, concatenate is handy and compact (I like it when I remember to use it), but doesn't appear to be required to "fix" B4. You can use 3 quotes, 1, 3 quotes a la
    vlookup("""1""", ...

  5. #5
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: How does vlookup parse a "numeric character" argument

    I will say that
    A1="1"
    is the most nonintuitive. It feels more like the 3 character representation. But, whadya know, it's LEN is 1. I'm not disagreeing with the reply given; just pointing out what appears mildly amusing to some of us

+ 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. Replies: 1
    Last Post: 08-10-2014, 01:22 PM
  2. [SOLVED] how to replace the "Alt-Enter" character in a cell with sway "@"
    By jmac1947 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-04-2014, 05:55 AM
  3. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  4. [SOLVED] how to separate last numeric character whice is separate by "-"
    By nur2544 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-22-2013, 08:32 AM
  5. [SOLVED] If A3=alpha numeric,"X", if A3=text,"Y", Blank
    By Gary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2006, 03:50 AM
  6. [SOLVED] "=RESULT()", "=ARGUMENT()", "=RETURN()" ??
    By PeteCresswell in forum Excel General
    Replies: 1
    Last Post: 03-31-2005, 04:06 PM
  7. [SOLVED] convert a number in Excel from numeric to text, i.e. "1" to "one"
    By buenavisionpaul in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-27-2005, 03:06 PM

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