+ Reply to Thread
Results 1 to 5 of 5

Create custom function to exceed 7 nested If functions in Excel 2003/XP/2000/97

  1. #1
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Create custom function to exceed 7 nested If functions in Excel 2003/XP/2000/97

    Hi All,
    I have used the below function called CalcValue in VBA to test more than 7 conditions, and each condition if true will return a different value.
    This function accepts as a parameter a cell and returns a value based on a complex IF THEN ELSE statement.

    Macro Code:
    The macro code looks like this:

    Please Login or Register  to view this content.

    My question is, how do I set the value returns to "other words" if all the conditions are tested? Please refer to my attached file for better understanding. Thanks a million
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I'm not sure what exactly you are asking, but I think Select case is much better for your use here

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342
    Hi royUK,
    I am terribly sorry to confuse you due to my poor explanation. What I want to do is after the "good","nice","fast","slow","long" are tested and return the value correctly. But I have other words, maybe "A" to be returned as it is as "A" then "B" returns to "B", "C" to "C". I hope this clears the confussion.Thanks again

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Then add more Cases to my code

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342
    Hi royUK,
    It works amazingly,really thankful for the great help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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