+ Reply to Thread
Results 1 to 4 of 4

Macro return error on vlookup formula part

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    Adelaide
    MS-Off Ver
    Excel 2010
    Posts
    18

    Macro return error on vlookup formula part

    Please help with this code, it doesn't work:

    Please Login or Register  to view this content.
    More precisely, this line doesn't work:
    Range("I" & R) = "=VLOOKUP(Size,Data!N:O,2,FALSE),IF(AND(Thick>10,Thick<16),VLOOKUP(Size,N:P,3,FALSE),IF(AND(Thick>15,Thick<21),VLOOKUP(Size,N:Q,4,FALSE),IF(AND(Thick>20,Thick<31),VLOOKUP(Size,N:R,5,FALSE)),IF(AND(Thick>30,Thick<50))))*QTY*(Complex+Assist+1)"
    Last edited by zbor; 05-28-2012 at 05:12 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: lookup

    Should this line include:

    Please Login or Register  to view this content.

    You should edit that post above and add code tags as per forum rules, you don't want to get scolded by a moderator.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: lookup

    Hi Stefanp,

    If is not starting at the beginning and that may be the issue as if syntax demands.. =if(criteria condition, what if true, what if false)... explore on this point to correct your formula. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Hope this help!

    LookUp.JPG

    And macro

    PHP Code: 
    Option Explicit
    Sub HoleDrillCut
    ()
    Dim R As LongSize As LongCol As LongThick As Long
    Dim Rng 
    As Range

    Range("B2").End(xlDown).Row ' Find first empty cell below B3'
    Size Cells(R"D").End(xlUp).Row Cells(R"D").Row      'Cells(R, "D").End(xlUp).Value'
    Thick Cells(R"E").End(xlUp).Value                                   '<=|'
    Set Rng = [o1].CurrentRegion
    Range
    ("B" R) = "HOLE DRILLING OR CUTTING":            Range("C" R) = "TBOL"
    Col = Switch(Thick <= 102Thick 163Thick 214Thick 315Thick >= 316)
    MsgBox Application.WorksheetFunction.VLookup(Cells(R"D").End(xlUp).ValueRngColFalse)

    Range("I" R).FormulaR1C1 "=VLOOKUP(R[" Size "]C[-5],R1C[5]:R9C[10]," Col ",FALSE)"

    End Sub 

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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