google-sheetsformula

How to utilize date add function in Google spreadsheet?


I believe the issue I am having now should be much easier in MS Excel. However, since my company uses Google Spreadsheets, I have to figure out a way.

Basically, I have a cell that contains a date value like "12/19/11", and I have another cell that contains a value like "DT 30". The task assigned to me is to add the value 30(days) to the date, so the result should be "1/19/2012".

I tried some things on Google Sheets, but I have two questions. The first is how to extract the numeric value "30" out of the string "DT 30"; the second question is that there seems to be no date add function built-in in Google Docs.

Could any experts offer some suggestions?


Solution

    1. To extract a numeric value out of your string you can use these 2 functions (Assuming you have your value in cell 'A1'):

      =VALUE(REGEXEXTRACT(A1, "\d+"))

      This will get you a numeric value.

    2. I've found no date add function in docs, but you can convert your date into internal date number and then add days number (If your value is in cell 'A2'):

      =DATEVALUE(A2) + 30

    I hope this will help.