+ Reply to Thread
Results 1 to 8 of 8

I want to include two conditions within an IF formula

  1. #1
    Registered User
    Join Date
    01-25-2019
    Location
    Mason, USA
    MS-Off Ver
    2013
    Posts
    4

    I want to include two conditions within an IF formula

    Hello All,
    I have this sheet that I need to use two formulas with. XIRR to calculate the IRR for a project and MIRR to calculate whenever the XIRR formula returns an error or a zero value.
    I tried the following:
    =IF(IFERROR(XIRR(D87:N87,D88:N88),0)=0,MIRR(D87:N87,0.1,0.02),XIRR(D87:N87,D88:N88))
    D87:D87 represent the net cash flows
    D88:N88 represent the corresponding dates
    I know where the error in my formula is coming from. the logical test returns "True" rather than 0.
    What I want from the formula is the following, Calculate the IRR using XIRR formula, if that calculation returns and ERROR or a ZERO value, then skip and calculate using MIRR formula instead. I am doing this because I want to use XIRR formula not considering we're reinvesting the cash flows but many times when I have a series of positive net cash flows and then in the 5th year for example it turns negative, XIRR formula returns an error of a zero value, which most of the time does not happen with MIRR formula.
    I tried different formulas and this is the one I lost hope at. If you have better suggestions, it would be greatly appreciated.
    I would really appreciate any help I can get. Thanks for anyone who can help me in advance.
    Example.pngExample.xlsx
    Regards
    Abdel

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: I want to include two conditions within an IF formula

    Welcome to the forum.

    I've never used XIRR or MIRR, but if I understand your logic correctly, this should do what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: I want to include two conditions within an IF formula

    1. Your dates include decimal time values, you need integer vals only
    2. Should B2 be negative?
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    01-25-2019
    Location
    Mason, USA
    MS-Off Ver
    2013
    Posts
    4

    Re: I want to include two conditions within an IF formula

    Thank you!
    I tired this but it returned a #NUM!
    I don't know why!

  5. #5
    Registered User
    Join Date
    01-25-2019
    Location
    Mason, USA
    MS-Off Ver
    2013
    Posts
    4

    Re: I want to include two conditions within an IF formula

    1. I took the screen shot before changing numbers to dates after I copied from my original file. In the attached excel, the dates are in the correct format.
    2. In fact having a negative cash flow after a series of positive cash flows is probably what causes this error. If you calculate using XIRR with a series of positive cash flows only, you wouldn't get any errors. In real world this is not realistic, you can have some projects with initial investment and then positive returns or negative net return in a following year.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,556

    Re: I want to include two conditions within an IF formula

    Hello abdelqaderdiab and Welcome to Excel Forum.
    The file attached to post #1 still has h:mm:ss (decimal) parts in the dates row even though the formatting only shows dates, example looking in the formula bar cell B3 reads 1/25/2019 2:34:36 PM (43490.6073577546). Change the values to integers or type in the dates.
    The documentation on both the XIRR function and the MIRR function states: "The series of values must contain at least one positive and one negative value".
    Once those changes have been made both the original formula and the one proposed by Aardigspook yield a value.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Registered User
    Join Date
    01-25-2019
    Location
    Mason, USA
    MS-Off Ver
    2013
    Posts
    4

    Re: I want to include two conditions within an IF formula

    Hello everyone. Just want to tell you that the formula below worked when I replaced the value in the "Or" function with external cells rather than including then within the formula. I think it was due to the fact that the formula return True instead of returning a value which is why I had to take another path and take one of the formulas out and evaluate separately. Thanks everyone.
    Old formula =IF(OR(ISERROR(XIRR(D87:N87,D88:N88)),XIRR(D87:N87,D88:N88)=0),MIRR(D87:N87,0.1,0.02),XIRR(D87:N87,D88:N88))
    New formula =IFERROR(IF(OR(Q73="NO IRR",(ROUND(Q73,1)=0)),"IRR Not Computed",XIRR(D60:N60,D69:N69)),"IRR Not Computed")
    Where Q73==IFERROR(XIRR(D60:N60,D69:N69),"NO IRR")
    I know I put a lot of Iferror in there but I was being cautious after all the struggle I had with this. Thanks everyone and hope no one suffers from finding this formula now.

  8. #8
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: I want to include two conditions within an IF formula

    Thanks for posting your solution, glad to see you got it working.

    If that takes care of your original question, then please take a moment to mark the thread as Solved so others know there's an answer here (instructions are in my sig). 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. Replies: 1
    Last Post: 10-09-2017, 05:06 PM
  2. [SOLVED] IF formula with AND conditions that include omitting named formulas
    By frsaxon in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-16-2017, 01:02 AM
  3. [SOLVED] IF formula to include multiple conditions
    By BOECKENJ in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 06-07-2015, 03:49 AM
  4. [SOLVED] IF formula to include multiple conditions
    By sunshine82 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2015, 09:16 AM
  5. Replies: 17
    Last Post: 08-26-2014, 01:05 PM
  6. IF(OR Formula will not include certain conditions
    By Holly.Pittam in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-17-2014, 05:53 AM
  7. Replies: 1
    Last Post: 11-09-2011, 04:45 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