+ Reply to Thread
Results 1 to 4 of 4

Explain the 2^15 used in LOOKUP to find last cell containing a specific value

  1. #1
    Registered User
    Join Date
    10-27-2010
    Location
    NC, United States
    MS-Off Ver
    2007
    Posts
    32

    Explain the 2^15 used in LOOKUP to find last cell containing a specific value

    =LOOKUP(2^15,SEARCH('1'!$A$2:$A$995,K2),'1'!$B$2:$B$995)


    Can any one give me a clue was to what the purpose of 2^15 is in this lookup formula?
    Obviously I know that from searching or clicking in the formula it is the lookup value but why could this number be so high. Obviously I don't understand the methodology behind this lookup. I don't see what this couldn't be 1 or 25... just as easy as 32768.

    Can someone help me with this???

  2. #2
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,676

    Re: Any LOOKUP Experts?

    SEARCH searches for the value K2 in all of the cells in the range 1'!$A$2:$A$995. It returns the position number of the start of that value (if found)........ and the largest number of characters allowed in a cell is 32767 or 2^15-1

    Having a lookup value of 2^15 therefore guarantees that that value will be larger than anything that SEARCH returns, this means that you get a match with the last cell that contains K2
    Audere est facere

  3. #3
    Registered User
    Join Date
    10-27-2010
    Location
    NC, United States
    MS-Off Ver
    2007
    Posts
    32

    Re: Any LOOKUP Experts?

    That was part of my inclination. Thanks for the help!

  4. #4
    Registered User
    Join Date
    05-19-2017
    Location
    US
    MS-Off Ver
    16
    Posts
    1

    Re: Any LOOKUP Experts?

    Quote Originally Posted by daddylonglegs View Post
    Having a lookup value of 2^15 therefore guarantees that that value will be larger than anything that SEARCH returns, this means that you get a match with the last cell that contains K2
    Doesn't it rather return a match to the cell in the result array which contains the search term furthest to the right within the string being searched? This is what would be represented as the largest value within the result array of the SEARCH function. LOOKUP then returns the largest value when no result is as big as the value you were looking up.
    Last edited by skifri; 05-19-2017 at 12:49 PM.

+ 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