I have a Google Spreadsheet that I want to have a unique number created in column A when I enter information in column B. Below is the formula I currently have that works, but I am wondering if there is a way to edit it so that instead of CDI it has the date(datestamp)?
=ArrayFormula(if(len(B:B),"CDI"&text(row(A:A),"000000"),iferror(1/0)))
Desired end result would be something like:
02232015001
Best Answer
You could replace
"CDI"&text(row(A:A),"000000")
withbut this would be the timestamp of now, not of when the cell was last updated.
To capture the update time, you need a script. The script below runs every time the spreadsheet is edited, checks whether there are entries in column B without an entry in column C, and adds a timestamp-based ID to column C in this case.
The result looks like this:
I put the year first, because otherwise the leading zero in the month would be omitted, decreasing readability. (The alternative, formatting ID as a string, is somehow unappealing).