Adding additional criteria to VBA solution in Excel
I realized that I need an additional criteria added to the great solution I received yesterday on this forum. I've been trying to solve it myself but don't have the skillset yet to solve it.
I have attached a sample spreadsheet that shows the results I am looking for once the additional criteria is added.
The additional criteria is:
If Column A = "AIP_ENR" or "AIP_AD" or AIP_GEN" then Expiry Issue = ""
The current solution's VBA code is as follows:
Function expiryIssue(rng As Range) As StringApplication.VolatileDim dte1 As RangeDim dte2 As RangeDim status As StringSet dte1 = rng.Cells(1, 1)Set dte2 = rng.Cells(1, 2)status = rng.Cells(1, 3)If status <> "Expired" And status <> "Cancelled" And status <> "Replaced" Then' If there is no Proposed or Approved expiry date If dte2 = "" And dte1 = "" Then expiryIssue = "Missing expiry dates" Else 'If there is no Approved Expiry date and the Proposed Expiry date is within 60 days of todays date If dte2 = "" Then If dte1 < Date + 60 Then expiryIssue = "Review proposed expiry date" Else 'If the Approved Expiry date is older than today's date If dte1 = "" Then If dte2 < Date Then expiryIssue = "Issue" Else If dte2 < Date Then expiryIssue = "Issue" End If End If End IfEnd IfEnd Function
Cheers,
Andrea