+ Reply to Thread
Results 1 to 6 of 6

Complex IF/AND/OR/THEN Statement

  1. #1
    Registered User
    Join Date
    02-11-2019
    Location
    St. Louis, MO
    MS-Off Ver
    Professional Plus 2016
    Posts
    3

    Complex IF/AND/OR/THEN Statement

    I need help solving a complex IF/AND/OR/THEN statement.
    Cell Legend
    A3 = total # of product deliveries
    B3 = current # of products received
    C3 = due date for total # deliveries (100, or cell A3)
    D3 = Project status

    In this situation, I am trying to solve D3, the project status (“On time,” “In work,” “Risk,” or “Late) based on the # of products received in relation to the due date. Below are the statements I am trying to make in a single formula, but am having a hard time with the syntax.
    1. If today’s date is later than the due date and the # received products is fewer than the total # of deliveries, then the status should indicate “Late”
    IF TODAY()>C3, AND B3<A3, “Late”

    2. If today’s date is earlier than the due date and the # received products is fewer than the total # of deliveries, then the status should indicate “In Work”
    IF TODAY()<C3, AND B3<A3, “InWork”

    3. If today’s date is greater than 2 weeks before the due date, or is equal to the due date and the # received products is fewer than the total # of deliveries, then the status should indicate “Risk”
    IF TODAY()>C3-14 OR TODAY()=C3, AND B3<A3, “Risk”

    4. If today’s date is earlier or equal to the due date and the # received products is greater than or equal to the total # of deliveries, then the status should indicate “On Time”
    IF TODAY()>C3, AND B3<A3, “On Time”

    A B C D
    1 Project
    2 # Deliveries # Received Due Date Status
    3 100 50 3/1/2019 ?


    I have spent so much time on figuring this out that my brain hurts :/
    Any help is appreciated!!
    Last edited by madouxan; 02-14-2019 at 03:39 PM. Reason: This inquiry has been solved.

  2. #2
    Forum Contributor
    Join Date
    09-19-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    208

    Re: Complex IF/AND/OR/THEN Statement

    I think your last pseudo-formula (#4) is written wrong based on your statement. It actually looks like you copied that from the first statement, which is the opposite of what you want.

    "If today's date is earlier or equal to the due date" would be "IF TODAY()<=C3" not "IF TODAY()>C3". And "the # received products is greater than or equal to the total # of deliveries" should be "B3>=A3" not "B3<A3". Please correct me if these assumptions are wrong.

    Taking that into account, try this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    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,938

    Re: Complex IF/AND/OR/THEN Statement

    Hi, welcome to the forum

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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

  4. #4
    Registered User
    Join Date
    02-11-2019
    Location
    St. Louis, MO
    MS-Off Ver
    Professional Plus 2016
    Posts
    3

    Re: Complex IF/AND/OR/THEN Statement

    Yep, looks like I forgot to change the formula for #4. Good catch!

    This formula works, except for the due date -14 days. Instead of reporting "Risk" for those 14 days leading up to the due date, it says "InWork"

    =IF(AND(TODAY()>C3,B3<A3),"Late",IF(AND(TODAY()<C3,B3<A3),"InWork",IF(AND(OR(TODAY()>(C3-14),TODAY()=C3),B3<A3),"Risk",IF(AND(TODAY()<=C3,B3>=A3),"On Time"))))

    I'm going to attempt to add the dummy spreadsheet here
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    09-19-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    208

    Re: Complex IF/AND/OR/THEN Statement

    It's probably due to the fact that "InWork" is TODAY()<C3, and "Risk" is TODAY()>(C3-14). So part of "InWork" range is also part of Risk date range (the 14 days preceeding the due date). To fix (hopefully), make a slight adjustment so that "InWork" excludes the 14 days prior to the due date:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-11-2019
    Location
    St. Louis, MO
    MS-Off Ver
    Professional Plus 2016
    Posts
    3

    Re: Complex IF/AND/OR/THEN Statement

    Thank you ¯\_(ツ)_/¯ !!!

    Yes, that worked!!!

+ 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. Help with a complex if statement.
    By kcgojnur in forum Excel General
    Replies: 5
    Last Post: 08-26-2016, 09:17 AM
  2. Complex If Statement
    By exc1967 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-28-2016, 11:52 AM
  3. [SOLVED] complex IF() statement, with AND()
    By WhiteWaterMatt in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-02-2016, 09:02 AM
  4. complex if statement
    By young_eeyore in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-11-2015, 07:37 PM
  5. [SOLVED] Help with complex If statement please
    By TimJ79 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-09-2014, 12:35 PM
  6. [SOLVED] Complex IF AND OR statement
    By amack05 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-09-2012, 11:09 AM
  7. Complex IF Statement?
    By BadBrick in forum Excel General
    Replies: 14
    Last Post: 04-08-2012, 12:12 PM

Tags for this Thread

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