Re: if date

Welcome to the Forum!

This one way you could do it using VBA.

Code

- Sub Test()
- 'test procedure
- 'A1 holds date to evaluate
- 'B1 holds amount to fill range
- SetAmountDue Range("A1").Value, Range("B1").Value
- End Sub
- Sub SetAmountDue(ByVal dtDueDate As Date, ByVal varAmount As Variant)
- 'get the difference in days from passed date to current date
- 'dtDueDate is the value held in A1
- 'varAmount is the passed value held in B1
- Select Case DateDiff("d", dtDueDate, Int(Now()))
- Case Is >= 90
- Range("G1") = varAmount
- Case Is >= 60
- Range("F1") = varAmount
- Case Is >= 30
- Range("E1") = varAmount
- Case Else
- 'nothing happens
- End Select
- End Sub

As i said this is only one way, you could do it with a UDT (User Defined Function) or you could also take a formula approach.