Results 1 to 8 of 8

Thread: Change Cell Contents if Cell Date is in Previous Month / 4 Months
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Sep 2019
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Change Cell Contents if Cell Date is in Previous Month / 4 Months

    Good morning!

    I have a layout that looks like this:




    For one criteria, I would like to:
    Display QUAL if the date is in the current or previous month.
    Display NC/QUAL if the date is before the previous month.
    Display UNQUAL if the date is blank.

    For a different criteria, I would like to:
    Display QUAL if the date is from May/June/July/Aug OR if the date is in Sept/Oct/Nov/Dec
    Display NC/QUAL if the date is prior to May
    Display UNQUAL if the date is blank.

    Thanks in advance!

  2. #2
    New Member
    Join Date
    Sep 2019
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Change Cell Contents if Cell Date is in Previous Month / 4 Months

    One example for any of these would probably be enough for me to figure out the rest.

  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    29,119
    Post Thanks / Like
    Mentioned
    483 Post(s)
    Tagged
    49 Thread(s)

    Default Re: Change Cell Contents if Cell Date is in Previous Month / 4 Months

    For the first part what happens if the date is in the future?
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  4. #4
    New Member
    Join Date
    Sep 2019
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Change Cell Contents if Cell Date is in Previous Month / 4 Months

    The date entered should never be in the future based on the way the spreadsheet works, but in a formula case QUAL would be acceptable

  5. #5
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    29,119
    Post Thanks / Like
    Mentioned
    483 Post(s)
    Tagged
    49 Thread(s)

    Default Re: Change Cell Contents if Cell Date is in Previous Month / 4 Months

    In that case how about
    =IF(A2="","UN",IF(MONTH(TODAY())-MONTH(A2)>=2,"NC/",""))&"QUAL"
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  6. #6
    New Member
    Join Date
    Sep 2019
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Change Cell Contents if Cell Date is in Previous Month / 4 Months

    That works perfectly - truly impressed with your solution!

    Looking to decipher your formula so I can re-arrange it based on the other parts of my spreadsheet, if the date range is blank, it returns UN. if the month of the date is either today's month or today's month minus two months, it returns NC/, and it always returns QUAL. Right?

  7. #7
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    51,032
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: Change Cell Contents if Cell Date is in Previous Month / 4 Months

    I would recommend using the DATEDIF function (https://exceljet.net/excel-functions...tedif-function) instead of MONTH in case your dates aren't in the same year.
    For example, let's say we were in January, and looking back at November or December dates. Substracting MONTHs will result in negative values.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  8. #8
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    29,119
    Post Thanks / Like
    Mentioned
    483 Post(s)
    Tagged
    49 Thread(s)

    Default Re: Change Cell Contents if Cell Date is in Previous Month / 4 Months

    Quote Originally Posted by Mazzic View Post
    That works perfectly - truly impressed with your solution!

    Looking to decipher your formula so I can re-arrange it based on the other parts of my spreadsheet, if the date range is blank, it returns UN. if the month of the date is either today's month or today's month minus two months, it returns NC/, and it always returns QUAL. Right?
    You've understood it correctly.
    Although as Joe4 has pointed out, I didn't factor in changing years.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •