Matching data with 90 days from date

psrs0810

Well-known Member
Joined
Apr 14, 2009
Messages
1,109
I have two sets of data – on sheet one there is a unique # and a date. On sheet two, I will have a listing of unique # and dates.
What I am trying to do is identify every time there is a unique # on sheet one to take the date next to it and identify any other rows where there is a match or within 90 days of the sheet 1 date.

Ie
Sheet 1 column A – 220302 Column B 4/22/2016
Sheet 2 will have a listing of numbers and dates – same columns
I need to find all rows where there is a match with the same number (220302) and 90 days out
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Code:
Sub hiLight()
Dim sh1 As Worksheet, sh2 As Worksheet, c As Range
Set sh1 = Sheets(1)
Set sh2 = Sheets(2)
    For Each c In sh2.Range("B1", sh2.Cells(Rows.Count, 2).End(xlUp))
        If c.Value = sh1.Range("B1").Value + 90 And c.Offset(, -1).Value = sh1.Range("A1").Value Then
            c.Interior.Color = vbYellow
        End If
    Next
End Sub

or

In C1 and drag down.

Code:
=IF(AND(A1=Sheet1!$A$1,B1=Sheet1!$B$1+90),"Yes","")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,485
Members
448,967
Latest member
visheshkotha

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