Share via

IIF Function multiple date ranges

Anonymous
2014-03-20T13:15:11+00:00

Hello, little rusty and need some help.

Need to write an IFF function to include the following:

If (Production Date) is between 10/22/13 and 1/20/14, then W

If (Production Date is between 7/16/13 and 10/21/13 then X

If (Production Date) is before 7/16/13 then Y,

If (Productiuon Date is blank, then Z

How can I pull this all together?

Thank you

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2014-03-20T14:54:37+00:00

    Hi, Jessica

    IIF([Production Date] >= #1/21/14#,"New Hire",

    IIF([Production Date] >= #10/22/13# and [Production Date]  <= #1/20/14#,"W",

    IIF([Production Date] >= #7/16/13# and [Production Date]  <= #10/21/13#,"X",

    IIF([Production Date] < #7/16/13# ,"Y",

    IIF([Production Date] Is Null,"Z")))))

    or also

    IIF([Production Date] >= #10/22/13# and [Production Date]  <= #1/20/14#,"W",

    IIF([Production Date] >= #7/16/13# and [Production Date]  <= #10/21/13#,"X",

    IIF([Production Date] < #7/16/13# ,"Y",

    IIF([Production Date] Is Null,"Z","New Hire"))))

    The IIF structure is:  IIF(condition,what do if true, what do if false)

    Bye Mimmo

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2014-03-20T13:48:40+00:00

    Hi Jessica

    IIF([Production Date] >= #10/22/13# and [Production Date]  <= #1/20/14#,"W",

    IIF([Production Date] >= #7/16/13# and [Production Date]  <= #10/21/13#,"X",

    IIF([Production Date] < #7/16/13# ,"Y",

    IIF([Production Date] = "","Z"))))

    Mimmo

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2014-03-20T14:29:25+00:00

    Perfect... One last question..

    I'm getting an #error on any production date greater than or equal to 1/21/14. I tried adding

    IIF([Production Date] >=#1/21/14#,"New Hire" and added an addition ) at the end, but the #error is still showing up.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-03-20T14:14:51+00:00

    Try with:

    IIF([Production Date] >= #10/22/13# and [Production Date]  <= #1/20/14#,"W",

    IIF([Production Date] >= #7/16/13# and [Production Date]  <= #10/21/13#,"X",

    IIF([Production Date] < #7/16/13# ,"Y",

    IIF([Production Date] Is Null,"Z"))))

    Mimmo

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2014-03-20T13:59:42+00:00

    Thank You very helpful.  The only piece not working is if the Product Date field is blank (empty), it needs to put Z, however it's leaving it blank

    Was this answer helpful?

    0 comments No comments