+ Reply to Thread
Results 1 to 5 of 5

Comparing Date Columns

  1. #1
    Forum Contributor
    Join Date
    03-19-2016
    Location
    Chicago, IL
    MS-Off Ver
    Office 2016 Professional
    Posts
    388

    Comparing Date Columns

    I want to create a new column (Column C) that flags examples if the dates are within the same month.
    As an example:
    Column A: 01/01/2017
    Column B: 01/30/2017
    Column C: If these dates were in the same month/year, then flag, 'Y', else 'N'. IF Column A or Column B are blank, then output 'N'.

    Thank you!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,062

    Re: Comparing Date Columns

    Maybe

    IF(OR(A1="",B1=""),"N",IF(TEXT(A1,"yymm")=TEXT(B1,"yymm"),"Y","N"))
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.83 for Mac MS 365
    Posts
    8,480

    Re: Comparing Date Columns

    a different twist on it...
    =IF(OR(A1="",B1=""),"N",IF(MONTH(A1)&YEAR(A)=MONTH(B1)&YEAR(B1),"Y","N"))
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Contributor
    Join Date
    03-19-2016
    Location
    Chicago, IL
    MS-Off Ver
    Office 2016 Professional
    Posts
    388

    Re: Comparing Date Columns

    One other scenario:

    Create a new date field:

    If Column A is populated, output that date in Column C
    If Column A is blank but Column B is populated, output that date in Column C.
    If both Column A and Column B are both populated, output the most recent date in Column C.

    Example 1:
    Column A: 6/2/2017
    Column B: 5/30/2017
    Column C expected value: 6/2/2017

    Example 2:
    Column A:
    Column B: 5/30/2017
    Column C expected value: 5/30/2017

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,062

    Re: Comparing Date Columns

    This is completely different from your oroginal request.
    Your original request asks to compare months and years and output a Y if they are in the same month.

    So, having made up your mind what you actually do want
    try this

    IF(AND(A1="",B1=""),"",MAX(A1,B1))

+ 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. Comparing two sheets with two columns each (ID & Date)
    By corsi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-27-2016, 09:24 PM
  2. Conditional Formatting - Comparing date columns
    By barnz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-09-2015, 12:32 AM
  3. Replies: 3
    Last Post: 04-23-2014, 05:14 PM
  4. Replies: 1
    Last Post: 02-08-2014, 04:34 PM
  5. Replies: 2
    Last Post: 04-18-2013, 02:03 PM
  6. [SOLVED] IF AND or SUMIFS comparing Months from 2 date columns and text from 2 other columns
    By jrochet in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-22-2012, 11:06 AM
  7. calculate percent met (comparing 2 date columns)
    By Cobra in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-01-2006, 05:01 PM

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