+ Reply to Thread
Results 1 to 11 of 11

Lookup not returning data due to "~"

Hybrid View

  1. #1
    Registered User
    Join Date
    06-28-2006
    Posts
    28

    Question Lookup not returning data due to "~"

    Hi,

    I've got a spreadsheet that has a Hlookup into a different spreadsheet. It is looking up codes such as MSPACF(RI) and these work fine and it is returning data associated with these codes

    The problem comes when I look up the code S&PCOMP(RI)~£ I have 4 codes that all end in ~£ and for each of these the lookup is returning N/A.

    Is there anyway to get this work? It's driving me mad!!!

    Many thanks
    Dom.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Have you tried ...
    CHAR(163)
    HTH
    Carim


    Top Excel Links

  3. #3
    Registered User
    Join Date
    06-28-2006
    Posts
    28
    Hi Carim,

    I have no idea what that means (though I am guessing CHAR(163) means character and relates to ~)

    How would I pur S&PCOMP(RI)~£ in using CHAR(163)

    Thanks!

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi again,

    I initially thought you were using Edit Replace ...
    Could you share you lookup() function ...?

  5. #5
    Registered User
    Join Date
    06-28-2006
    Posts
    28
    Hi,

    The Hlookup I am using is

    =HLOOKUP(A266,'J:\PMA UK New\Performa\Dynamic Data\Indices\[DataStream Download.xls]Sheet1'!$5:$11,3,FALSE)

    Where A266 is the cell reference for S&PCOMP(RI)~£

    I'll attach the files in a bit via a zip file, I am just waiting to IT to put win zip on my computer.

    Thanks!!

  6. #6
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    Its a mystery to me, if the list is sorted ascending the lookup function works for the values, but if an exact match is required it fails. I have no idea why but it must be the character highlighed

    Regards

    Dav

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

    I've got a spreadsheet that has a Hlookup into a different spreadsheet. It is looking up codes such as MSPACF(RI) and these work fine and it is returning data associated with these codes

    The problem comes when I look up the code S&PCOMP(RI)~£ I have 4 codes that all end in ~£ and for each of these the lookup is returning N/A.

    Is there anyway to get this work? It's driving me mad!!!

    Many thanks
    Dom.
    Hi,

    perhaps

    If range_lookup is FALSE and lookup_value is text, then you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character

    from
    http://office.microsoft.com/en-us/ex...093351033.aspx

    will explain?


    =VLOOKUP("A~~A",A1:A3,1,FALSE)

    finds A~A

    ---
    Last edited by Bryan Hessey; 02-01-2007 at 08:50 AM.
    Si fractum non sit, noli id reficere.

  8. #8
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    with the guidance provided by Brian, you need to replace the ~ with another character and use this for the match function. I have used the @ character in my example. Preferably a character that is not used in the other names. then I would use the match function to rerun the values you were interested in. hopefully u can download the spreadsheet and see more clearly

    otherwise if the value being looked up is in a9 the following needs to be entered as an array (shft ctrl enter)

    =OFFSET($A$7,0,MATCH(SUBSTITUTE(A9,"~","@"),SUBSTITUTE($5:$5,"~","@"),0)-1)

    Regards

    Dav
    Attached Files Attached Files

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,711
    As Bryan says, to search for a ~, or text containing a ~ you simply need to search for a "~~" therefore change your formula to

    =HLOOKUP(SUBSTITUTE(A266,"~","~~"),'J:\PMA UK New\Performa\Dynamic Data\Indices\[DataStream Download.xls]Sheet1'!$5:$11,3,FALSE)

    This will work equally well, whether your data contains ~ or not

  10. #10
    Registered User
    Join Date
    06-28-2006
    Posts
    28
    Thanks a lot guys - much appreciated. Got it working now.

    Many thanks. Have a good evening!

+ 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