+ Reply to Thread
Results 1 to 5 of 5

IF with IF AND

  1. #1
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Nottingham
    MS-Off Ver
    Office 2016
    Posts
    355

    IF with IF AND

    So. I know WHY this is giving me a #VALUE! response, I am just unsure as to how to stop it.

    =IF(K2=0,"",IF(AND(K2>0,F2=0),2*K2,6*K2))

    IF(AND(K2>0,F2=0),2*K2,6*K2) Means either do 2*K2 OR do 6*K2, and if K2 is blank then it will return a #VALUE error

    So how do I get L2 to be left blank if K2 is blank?

    I know I can change
    =IF(OR(DATEDIF($J2,$K$1,"y")=4,DATEDIF($J2,$K$1,"y")=9),DATEDIF($J2,$K$1,"yd")/365,"")
    to
    =IF(OR(DATEDIF($J43,$K$1,"y")=4,DATEDIF($J43,$K$1,"y")=9),DATEDIF($J43,$K$1,"yd")/365,0)

    but the "0" makes column K to display 0%, whereas I would prefer it to be blank.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: IF with IF AND

    K2:
    =IF(OR(DATEDIF($J2,$K$1,"y")=4,DATEDIF($J2,$K$1,"y")=9),DATEDIF($J2,$K$1,"yd")/365,"")

    L2:
    =IF(K2="","",IF(AND(K2>0,F43=0),2*K2,6*K2))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: IF with IF AND

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: IF with IF AND

    Thanks for the rep.

  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
    52,936

    Re: IF with IF AND

    Darry for future reference, please do not post duplicate threads.
    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

+ 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