+ Reply to Thread
Results 1 to 4 of 4

Custom Formula using VBA

  1. #1
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Custom Formula using VBA

    Hi,

    I have the following formula which I want to be able to use as a custom function i.e. =SWITCH(Cell1,Cell2,"Profit","(Loss)").

    =IF(AND(F23<0,H23<0),"(Loss)",IF(AND(F23>=0,H23>=0),"Profit",IF(AND(F23<0,H23>=0),"(Loss)/profit","Profit/(loss)")))

    Is this possible at all?

    Regards

    Colin

  2. #2
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Custom Formula using VBA

    Hi Colin,

    Try this:

    Please Login or Register  to view this content.
    Regards,
    Rick

  3. #3
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Custom Formula using VBA

    Where do I put the code - This workbook or Sheet1?

    Also do I use it as follows:

    =SWITCH(A1,A2,"Profit","(Loss)")

  4. #4
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Custom Formula using VBA

    Got it - brilliant work - thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Use custom formula returned range in new formula?
    By Platr in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-19-2014, 12:01 PM
  2. Custom Formula I think...
    By Im_so_lost in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2014, 01:37 AM
  3. A custom formula help
    By JdavisTitanSolar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-22-2013, 03:45 PM
  4. Custom Round Up Formula
    By John Bates in forum Excel General
    Replies: 4
    Last Post: 04-25-2011, 05:40 PM
  5. custom formula
    By framedoctor in forum Excel General
    Replies: 2
    Last Post: 10-13-2010, 06:18 PM
  6. custom formula
    By gibarian in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 10-12-2006, 09:44 AM
  7. Custom Header with Formula
    By Randy in forum Excel General
    Replies: 6
    Last Post: 06-15-2006, 07:20 AM
  8. How can I see custom formula code?
    By Lee Harris in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-06-2005, 10:25 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