+ Reply to Thread
Results 1 to 2 of 2

Nested if and lookup statements in VBA

  1. #1
    Registered User
    Join Date
    10-13-2010
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2004 (Mac)
    Posts
    1

    Nested if and lookup statements in VBA

    Hello!

    The function I have written into excel is:

    =IF(F22=0.04, LOOKUP(F21, 'R123 isobaric'!A8:A198, 'R123 isobaric'!F8:F198),

    IF(F22=0.05, LOOKUP(F21, 'R123 isobaric'!A209:A399, 'R123 isobaric'!F209:F399),

    IF(F22=0.06, LOOKUP(F21, 'R123 isobaric'!A410:A604, 'R123 isobaric'!F410:F604),

    IF(F22=0.07, LOOKUP(F21, 'R123 isobaric'!A614:A808, 'R123 isobaric'!F614:F808)))))

    This currently works as it is written in a cell, I would like to have this in a macro instead; how do I write this so that it will work?

    Thanks! (I am new to this whole macro/VBA stuff....)

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Nested if and lookup statements in VBA

    Quote Originally Posted by limekiln
    This currently works as it is written in a cell, I would like to have this in a macro instead; how do I write this so that it will work?
    Can you elaborate as to the why and in what context you want to use this "formula" in VBA ?
    (Are you looking to implement the formula via a sub routine or are you looking to convert the formula to a Function ?)

    Generally speaking "native" functions will perform quicker than an equivalent VBA Function.

    In short - more info. please.

+ 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