+ Reply to Thread
Results 1 to 12 of 12

Nested IF AND statement producing #NAME?

  1. #1
    Forum Contributor
    Join Date
    08-15-2005
    Location
    Oklahoma
    MS-Off Ver
    2010, 2013
    Posts
    113

    Smile Nested IF AND statement producing #NAME?

    The following Nested IF AND is producing a #NAME? in the cell:

    =IF(AND($F$4=1,(A42+4*365).GE.AC38),AL46*(AI46-$A$55)*(1-0.01),AL46*(AI46-$A$55)*(1-$A$51))

    The variables A42 and AC38 are dates. A42 is input and AC38 is calculated as all other dates in column AC. I want the program to switch calculation after the calculated date AC38 is four (4) years after start of project, i.e. when A42 + (4 * 365) greater than the calculated date AC38.

    The following formula works fine which does not include the AND statement:

    =IF($F$4=1,AL47*(AI47-$A$55)*(1-0.01),AL47*(AI47-$A$55)*(1-$A$51))
    Last edited by Jim15; 06-25-2013 at 12:28 PM.
    Jim15

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: Nested IF AND statement producing #NAME?

    I don't understand what this means
    (A42+4*365).GE.AC38)
    Please explain what this means.

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    08-15-2005
    Location
    Oklahoma
    MS-Off Ver
    2010, 2013
    Posts
    113

    Re: Nested IF AND statement producing #NAME?

    When A42 (a date) + (4 years x 365 days/year) is greater than AC38 (future date) then switch to secondary calculation.

  4. #4
    Forum Contributor
    Join Date
    08-15-2005
    Location
    Oklahoma
    MS-Off Ver
    2010, 2013
    Posts
    113

    Re: Nested IF AND statement producing #NAME?

    Should be like this:

    AC38.GE.(A42+(4*365)).

    When the calculated date is greater than or equal to the starting date plus 4 years switch to secondary calculation.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Nested IF AND statement producing #NAME?

    I think what Alan was asking about was the bolded part below...
    =IF(AND($F$4=1,(A42+4*365).GE.AC38),AL46*(AI46-$A$55)*(1-0.01),AL46*(AI46-$A$55)*(1-$A$51))

    excel is trying to use that as a function - which doesnt exist

    Also, an AND() statement is usually a test of a series of conditions that must be met for something to happen...=and(A1=1, B1=2, C1=3) etc
    But looking at your formula, I only see 1 test, and then a bunch of calcs?

    =IF(AND($F$4=1,(A42+4*365).GE.AC38)and then what?,AL46*(AI46-$A$55)*(1-0.01)and then what?,AL46*(AI46-$A$55)*(1-$A$51)and then what?)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Contributor
    Join Date
    08-15-2005
    Location
    Oklahoma
    MS-Off Ver
    2010, 2013
    Posts
    113

    Re: Nested IF AND statement producing #NAME?

    The objective of the IF AND is to test two (2) criteria of which both must be positive to calculate using first equation. In other words, if these 2 criteria are true, use equation 1. In not, use equation 2.

    =IF(AND($F$4=1,AC46.GT.($A$42+(4*365))),AZ46*(AI46*0.01+$A$55),AZ46*(AI46*$A$51+$A$55))

    Explained:

    If $F$4=1 and AC46.GT.($A$42+(4*365))) are true, then AZ46*(AI46*0.01+$A$55). If one or both are not true, then AZ46*(AI46*$A$51+$A$55)).

    If $F$4 = 1 then calculations will continue until column AC value (successive monthly periods) exceeds 4 *365 (4 years or 48 months) from starting date $A$42. As soon as 48 months elapses, the two IF AND conditions are not met and calculation reverts to 2nd equation.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested IF AND statement producing #NAME?

    AC38.GE.(A42+(4*365)) there is no such thing as .GE. in excel you need

    AC38>=(A42+(4*365))
    > is greater than
    < is less than
    >= greater or equal
    <=less than or equal
    <> does not equal
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested IF AND statement producing #NAME?

    forum is double posting again lol

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Nested IF AND statement producing #NAME?

    Thanks Martin, I was trying to figure out what the GE. meant...hopfullly thats what the OP meant too?

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: Nested IF AND statement producing #NAME?

    Martin. Thanks from me, too. I was totally baffled by the GE.

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested IF AND statement producing #NAME?

    In Fortran, operator .GE. means "greater than or equal to

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Nested IF AND statement producing #NAME?

    well then it now makes perfect sense (not lol)

+ 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