+ Reply to Thread
Results 1 to 3 of 3

Simple pass fail function in excel

  1. #1
    Registered User
    Join Date
    11-22-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question Simple pass fail function in excel

    Hello everyone this is my first post in these forums hopefully you guys could offer me some advice I have never done programming before and we had to take it in my computers business functions course.

    I have to create a simple function where the program takes a grade either 100 - 50 or 49 -0 the program will then output "pass" for the first option and "fail" for the second.

    When I use the function it says #VALUE! I cant figure out what is wrong. I am using excel 2010.

    Function passfail(grade As Double) As Double
    If grade >= 50 Then
    passfail = ("Pass")
    Else
    If grade < 50 Then
    passfail = ("Fail")
    End If
    End If

    End Function
    Thank you for any help you can offer

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Simple pass fail function in excel

    slider203,

    Welcome to the forum!
    In the future, please use Code tags to surround code and not Quote tags.

    As to your question, its because you've specified the output of the function to be Double, and not String. So when you set the function = "Pass" or "Fail", it sees that that isn't a double value, and errors.

    Give this a try:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    11-22-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Simple pass fail function in excel

    Sorry about the Quote tags next time I will use the proper tag, but thank you that helped a lot and now I have a working program I really appreciate it

+ 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