Consulting

Results 1 to 4 of 4

Thread: vlookup help

  1. #1
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location

    vlookup help

    I have to look up for a value using vlookup in multiple sheets(all sheets) except for current sheets.

    Is there a way to do that?

    thanks

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Not with vlookup. Do you need a dynamic link or can you run a macro/event code to return values?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    I found this and it works great, just really slow.

    =VLOOKUP(A2,INDIRECT("'"&INDEX({"Sheet1";"Sheet2";"Sheet3";"Sheet4";"Sheet5 ";"Sheet6";"Sheet7";"Sheet8"},MATCH(1,--(COUNTIF(INDIRECT("'"&{"Sheet1";"Sheet2";"Sheet3";"Sheet4";"Sheet5";"Sheet6 ";"Sheet7";"Sheet8"}&"'!A2:A200"),A2)>0),0))&"'!A2:C200"),2,0)

    Source
    http://www.eggheadcafe.com/conversat...eadid=29322760

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    I'm wrong again!

    Here's a UDF solution to try
    [vba]
    Option Explicit
    Function VV(Srch, shts, cols, col)
    Dim sh1 As Long, sh2 As Long, i As Long, x
    sh1 = Sheets(Split(shts, ":")(0)).Index
    sh2 = Sheets(Split(shts, ":")(1)).Index
    For i = sh1 To sh2
    x = Application.VLookup(Srch, Sheets(i).Columns(cols), col, False)
    If IsNumeric(x) Then
    VV = x
    Exit Function
    End If
    Next
    VV = "N/A"
    End Function

    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •