Results 1 to 4 of 4

User Defined Function with If statement, does not work, incorrect code?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    User Defined Function with If statement, does not work, incorrect code?

    Hi there I am trying to create the following function but I cannot seem to get it working correctly. Any ideas?

    Public Function Result(Formula, Current, Previous)
    
    If Formula = "NPID" Then Result = (Current - Previous) / Previous
    If Formula = "PPID" Then Result = Current
    End Function
    Any help would be grately appreciated.
    Last edited by zbor; 03-07-2014 at 09:24 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Trying to create UDF to produce different results depending on different inputs
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2014, 09:58 AM
  2. Cannot get User Defined Function to work
    By spike1988 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2013, 06:22 PM
  3. User Defined Function to work as calculator
    By SAGAR KHOLLAM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-18-2012, 07:31 AM
  4. my user defined function doesn'work
    By an61sa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2012, 01:50 PM
  5. Can't get VLOOKUP to work from user defined function
    By dmcquinn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2010, 02:17 PM

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