Consulting

Results 1 to 2 of 2

Thread: VBA Nested Lookup as a UDF

  1. #1

    VBA Nested Lookup as a UDF

    I was wondering how to take the following formula: =_xlfn.IFERROR(LOOKUP(2,1/(($A$2:$A$7=$B11)*($C$2:$C$7<=D$10)),$B$2:$B$7),LOOKUP(2,1/($A$2:$A$7=$B11),$B$2:$B$7))

    and make it a user defined function?

    I would like the user to be able to select the crieteria.

    BTW, I'm not familiar with building UDF in VBA (2007 Excel).

    I've attached a sample.

    Thanks!
    Attached Files Attached Files

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Reverse columns D:H in the second table and use

    =INDEX($D$11:$H$16,MATCH($A2,$B$11:$B$16,0),MATCH($C2,$D$10:$H$10,-1))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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