Compare Two Dates by Ignoring the Year

gymwrecker

Active Member
Joined
Apr 24, 2002
Messages
390
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Is it possible to use a formula in Conditional Formatting that compares two dates but ignores the year? Using the below data as an example, cells A3 and B3 share the same month and day, therefore, I would like to use Conditional formatting so cell B3 can turn green or any color I chose... Please advise...

A1 = 1995/05/20
B1 = 1996/05/19

A2 = 1990/11/21
B2 = 1993/10/02

A3 = 1994/05/13
B3 = 1995/05/13
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Where my test range is B2:B16 and the cf applies to that range, this works to highlight the cell above. Perhaps if you offset -1 instead of 1 that will work for you.

=AND(MONTH(B2)=MONTH(OFFSET(B2,1,0)),DAY(B2)=DAY(OFFSET(B2,1,0)))
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

See if this is what you want. It assumes the values are actual dates (numbers), not text values.

22 09 10.xlsm
AB
11995/05/201996/05/19
21990/11/211993/10/02
31994/05/131995/05/13
Match day month
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B1:B3Expression=TEXT(A1,"ddmm")=TEXT(B1,"ddmm")textNO
 
Upvote 0
Thank you Peter! I just updated my account details. For some reason I cannot get it to work, not sure what is it that I'm doing wrong. Actual mini table is below. On this example, I need for cell H7 to change to green since the month and day is the same as cell G7:

Match-Day-Month.xlsx
ABCDEFGH
1RCCRankYears Creditable ServiceHome ZIP CodeHome StateCountyInitial Entry Military DateYear End Retirement (Mo/Dy)
2TPUMAJ2129607SCGreenville1980-02-030226
3TPULTC2620147VALoudoun1980-05-010531
4TPUSSG2596793HIMaui1981-02-230314
5TPUSGM3688007NMDona Ana1981-08-190818
6TPUCOL3596707HIHonolulu1982-02-191023
7TPUCW53787111NMBernalillo1982-04-010401
8TPULTC4096822HIHonolulu1982-04-120411
SheetData
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H2Expression=TEXT(G2,"ddmm")=TEXT(H2,"ddmm")textNO
 
Upvote 0
For some reason I cannot get it to work,
The reason is that in your original examples, both columns were dates. In your latest sample, column H is not a date.

Depending on whether your column H is a text value (as in my column H) or is a numerical value formatted to 4 digits (as in my column I) one of these should work for you.

22 09 11.xlsm
GHI
1Initial Entry Military DateYear End Retirement (Mo/Dy)
21980-02-0302260226
31980-05-0105310531
41981-02-2303140314
51981-08-1908180818
61982-02-1910231023
71982-04-0104010401
81982-04-1204110411
Match day month
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:I8Expression=--TEXT(G2,"mdd")=I2textNO
H2:H8Expression=TEXT(G2,"mmdd")=H2textNO
 
Upvote 0
Solution
Peter, I got it to work now! Thank you for the expert advise!
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,214,849
Messages
6,121,922
Members
449,056
Latest member
denissimo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top