Forum Discussion

Kneshalewiseeocgov's avatar
Kneshalewiseeocgov
Copper Contributor
Jan 10, 2023

excel dates

Hi, I hope someone can help. I am working on spreadsheet with a column that will have received dates for cases as they come in and I want to add a column that will add 30 days to that date automatically as I enter the received dates. I have searched so many videos and I have not found anything that helps. Someone please help.

3 Replies

  • Kneshalewiseeocgov 

    Let's say you have dates in D2 and down. In another column, enter this formula in row 2, then fill down:

    =IF(D2="","",D2+30)

    If your data are in a table, you can use a formula such as

    =IF([@[Date Received]]="","",[@[Date Received]]+30)

    where Date Received is the name of the date column.

    This will propagate to new rows automatically.

    • Kneshalewiseeocgov's avatar
      Kneshalewiseeocgov
      Copper Contributor
      Thank you but I do not have dates listed yet and each date will be different depending on receipt.
  • Kneshalewiseeocgov 

    Maybe with these lines of code. You can enter a date in any cell in range A2:A25 and the date + 30 days is added in the adjacent cell.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim rngBereich As Range
    
    Set rngBereich = Range("A2:A25")
    
    If Not Application.Intersect(Target, rngBereich) Is Nothing Then
    
    If IsDate(Target.Value) Then
    Target.Offset(0, 1).Value = Target.Value + 30
    Else
    
    End If
    
    End If
    
    End Sub

     

Resources