+ Reply to Thread
Results 1 to 3 of 3

Thread: Multiple If Statement in a UDF

  1. #1
    Registered User
    Join Date
    11-08-2010
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    4

    Multiple If Statement in a UDF

    Hiya,

    Im trying to build something like this... I think i have the body of it, but i keep getting compliation errors, not surprising though as it's only my second ever UDF Any help would be appreciated.


    Function Template (value AS Integer, word AS string) AS string
    IF(value = "01") //if cell value = 01
    AND IF(word ="test") // if cell value x = 01 and cell value y = test
    Template = "yes" //return YES
    ELSE
    IF(value = "02")
    AND IF (word = "test2")
    Template = "yes"
    //repeat for all posibilities
    ELSE
    Template = "no" //return NO for all cases not listed
    END IF
    END FUNCTION


    I know its pretty rough, but i think the guts of it is there based on my previous basic programming experience.... little help?


    Thanks

    Andrew

  2. #2
    Valued Forum Contributor
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2003
    Posts
    2,488

    Re: Multiple If Statement in a UDF

    hi, Andrew, please wrap VB code in code tags (see Forum Rules for details)

  3. #3
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,154

    Re: Multiple If Statement in a UDF

    DataJunkie
    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore Moderators' or Administrators' requests - note that this includes requests by senior members as well, if you are unclear about their request or instruction then send a private message to them asking for help. Do not post a reply to a thread where a moderator has requested an action that has not been complied with e.g Title change or Code tags...etc
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

+ 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.2.0