Results 1 to 2 of 2

having hopefully small issue with a lookup formula/function in vba

Threaded View

hopefulhart having hopefully small issue... 08-12-2015, 11:43 AM
Bernie Deitrick Re: having hopefully small... 08-12-2015, 01:02 PM
  1. #1
    Registered User
    Join Date
    10-25-2013
    Location
    canada
    MS-Off Ver
    Excel 2007
    Posts
    79

    having hopefully small issue with a lookup formula/function in vba

    hello,

    i have been using a lookup code such as
    chance = Evaluate("LOOKUP(RAND(),{0,0.5},{""A"",""B""})")
    as part of a larger module and it has been working exactly how i expected

    i want to modify it a bit so that the "{0,0.5}" part is a changing variable depending on other code
    ie:
    chance = Evaluate("LOOKUP(RAND(),{0,x},{""A"",""B""})")
    however i got an error message when i got to that line of code.
    i was wondering if i need to dim x as something in particular for vba to recognize it, i have it as
    Dim x As Double
    or maybe there is another issue that im missing

    thanks for any thoughts on this one


    well i figured out a solution right after i posted!!
    Dim x As String, y As Double
    y = 0.2
    x = "LOOKUP(RAND(), {0," & y & "}, {""A"",""B""})"
    chance = Evaluate(x)
    seems to work, may not be the best way but it works
    Last edited by hopefulhart; 08-12-2015 at 11:57 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Failed Lookup based on small function
    By MattRNR in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-20-2013, 09:03 PM
  2. [SOLVED] INDEX SMALL array formula issue
    By davepoth in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2013, 07:13 AM
  3. Formula issue with LARGE and SMALL
    By Pearlyn in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-30-2013, 03:16 AM
  4. [SOLVED] Issue with returning proper row number using =Small Function
    By Sardaukar in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-13-2013, 09:21 AM
  5. if, index, small - formula issue
    By jw01 in forum Excel General
    Replies: 6
    Last Post: 10-24-2012, 01:21 AM
  6. if(small(index...formula issue
    By jw01 in forum Excel General
    Replies: 7
    Last Post: 01-26-2012, 12:05 PM
  7. Large/Small Function Issue
    By ihdalton in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2009, 10:31 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