+ Reply to Thread
Results 1 to 8 of 8

Formula that is based on date and string

  1. #1
    Forum Contributor
    Join Date
    10-15-2009
    Location
    Broooklyn, NY
    MS-Off Ver
    Excel 2016
    Posts
    207

    Formula that is based on date and string

    Hi
    I have a field called "Project Reporting", which should simply be "Yes" or "No". However, the result depends on the following:
    It should be Yes if:
    WIP field has a "Yes" string OR
    WIP field has "No" string and Completion Date is within the 2 months from the current date.
    ELSE:
    Project Reporting should be indicated as "No".
    Attached Files Attached Files

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Formula that is based on date and string

    Maybe

    =IF(AND(B2="Yes",A2>=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY()))),"Yes","No")
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    10-15-2009
    Location
    Broooklyn, NY
    MS-Off Ver
    Excel 2016
    Posts
    207

    Re: Formula that is based on date and string

    No, It does not satisfy the intent.
    It should be Yes if:
    WIP field has a "Yes" string OR WIP field has "No" string and Completion Date is within the 2 months from the current date

    Using your formula, it says No throughout. C2 should be Yes, C3 should be No, C4 should be Yes and C5 should be Yes.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Formula that is based on date and string

    C4 does not have a date so how is it "Yes"

    Try...

    =IF(AND(OR(B2={"Yes","No"}),A2>=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY()))),"Yes","No")

  5. #5
    Forum Contributor
    Join Date
    10-15-2009
    Location
    Broooklyn, NY
    MS-Off Ver
    Excel 2016
    Posts
    207

    Re: Formula that is based on date and string

    It's not purely based on the date. If there is no Completion Date, it means that the work is not completed and therefore WIP=Yes. It should be based on the WIP entry as well as completion date entry. WIP should be a primary factor and completion date should be secondary. Don't use the assumption if the date is blank, WIP=Yes.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Formula that is based on date and string

    =IF(ISBLANK(A2),"Yes",IF(AND(OR(B2={"Yes","No"}),A2>=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY()))),"Yes","No"))

  7. #7
    Forum Contributor
    Join Date
    10-15-2009
    Location
    Broooklyn, NY
    MS-Off Ver
    Excel 2016
    Posts
    207

    Re: Formula that is based on date and string

    It works but it does not meet the intent. It's important to use WIP as a primary factor because project can be cancelled and might not have a completion date. In such cases, WIP=No. Currently, I have the following formula for WIP: =IF(OR(U10<>"",COUNT(SEARCH({"cancel"},W10))),"No","Yes"). If you use the logic provided and I change B2 to No, Project Reporting still equals to Yes. WIP is the prime criteria, completion date is a secondary

  8. #8
    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,946

    Re: Formula that is based on date and string

    see if this will give you what you need? it gives all the answers you specified

    =IF(OR(B2="Yes",A2="",A2>=TODAY()-60),"Yes","No")
    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