# Google Sheets formula help. How would I create a conditional format for any 2 dates in a row that fall between 30 days of each other?

How would I create a conditional format for any 2 dates in a row that fall between 30 days of each other for any employee based on the infraction type in column B, dates are in column A? Example if the 3 dates are 1/10/22, 1/23/22 & 2/2/22 it would highlight all 3 dates but not 30 days from today. Since this is for work I cannot post the sheet view.

How would I formulate this to stay highlighted in yellow?

• Welcome to Web Applications. What is the question? Where do you get stuck? Also please add a brief description of your search efforts as is suggested in How to Ask.
– Rubén
Jan 10 at 17:15
• You can create a spreadsheet with a few rows of realistic sample data, set up the way your real sheet is set up. Keep in mind that those here who might choose to help you are all volunteers. So the more you can do to encourage that help, the more likely you are to receive it. In addition, your post is unclear. You said you want to highlight any dates that "fall between 30 days of each other for any employee"; but then you added "but not 30 days from now." Those thee dates will still be within 30 days of each other a year from now. Do you mean within 30 days of the current date? Jan 11 at 1:51
• In the spreadsheet link you can see on the 1st tab I have a few dates for Jack & one for Matt, on the second tab when I select Jack from the drop down I need it so the 2 assaults within 30 days of each other highlight & stay highlighted as in this example we are tracking behavior of the students. For Jack the 2 highlighted would be 12/26/21 & 12/31/21 both Assaults but it wouldn't highlight 2/22/22's Assault because it is outside of the 30 day criteria from the 12/26/21 date & the 12/25/21 infraction wouldn't highlight either because it is an Assault. I am sorry about the confusion. Jan 11 at 15:48
• Someone in another group helped me with this & it works great. =and( B4 = "Assault", or( abs(A4 - A5) < 30, abs(A4 - n(A3)) < 30 ) ) Jan 11 at 22:20