Results 1 to 1 of 1

Consecutive lookup gives errors

Threaded View

  1. #1
    Registered User
    Join Date
    08-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    59

    Consecutive lookup gives errors

    Hi,

    I use a lookup function to fill values on a worksheet, SecOS using values from a 2nd worksheet, HQLA_Equity. It works fine.

    On the same worksheet,SecOS , I use another lookup using values from a 3rd worksheet, BRisk.
    When the code executes this, it alters the values filled from first lookup

    <code>
        Set wbexcel = ThisWorkbook
    
        Set ws = wbexcel.Sheets("SecOS")
    
        ws.Cells.ClearContents
    
       
    
     
    
    '    strfilename = Application.GetOpenFilename("Text Files (*.csv),*.csv", , "Provide Text or CSV File:")
    
     
    
        strfilename = Application.GetOpenFilename
    
        With ws.QueryTables.Add(Connection:="TEXT;" & strfilename, Destination:=ws.Range("A1"))
    
            .TextFileParseType = xlDelimited
    
            .TextFileCommaDelimiter = True
    
            .Refresh
    
     
    
        End With
    
       
    
        MsgBox ("SecOS file imported")
    
       
    
        Set wbexcel = ActiveWorkbook
    
        Set ws = wbexcel.Sheets("SecOS")
    
       
    
        
    
       
    
        'Add HQLA_FR2052A column
    
        
    
        ws.Range("AS1").Value = "HQLA_FR2052A "
    
       
    
       'Add HQLA_FR2052A values
    
       
    
        ws.Range("AS2:AS" & ws.Cells(Rows.Count, "V").End(xlUp).Row).FormulaR1C1 = "=VLOOKUP(""*""&RC[-23]&""*"",HQLA_Equity!C3:C29,27,0)"
    
       
    
        
    
        ' Add SECTOR_DES column
    
       
    
        ws.Range("AT1").Value = " SECTOR_DES"
    
       
    
     
    
        'Read SECTOR_DES values from BRisk sheet and fill col AT in SecOS
    
     
    
    '    Set ws = wbexcel.Sheets("SecOS")
    
         
    
    '   Populate column AT with formula
    
     
    
    '    ws.Range("AT2:AS" & ws.Cells(Rows.Count, "V").End(xlUp).Row).FormulaR1C1 = "=VLOOKUP(""*""&RC[-24]&""*"",BRisk!C1:C4,4,0)"
    </code>
    Last edited by davesexcel; 08-23-2022 at 06:32 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to avoid lookup errors when no data in lookup range
    By prudential in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2018, 01:14 AM
  2. V-Lookup and sum three consecutive rows
    By gfl0101 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-21-2017, 02:34 PM
  3. Lookup formula errors out
    By aresquare1 in forum Excel General
    Replies: 1
    Last Post: 10-01-2015, 09:42 AM
  4. [SOLVED] LOOKUP / VLOOKUP Errors
    By cpalmer72 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-21-2014, 02:33 PM
  5. Lookup based on the next consecutive value
    By andrewc in forum Excel General
    Replies: 3
    Last Post: 01-24-2014, 11:25 AM
  6. VBA Lookup errors
    By dontich in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2012, 11:33 AM
  7. Lookup (Unknown errors?)
    By Cyberpawz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-18-2007, 11:37 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