Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a spreadsheet to track student loan outs that will automatically put the date in an adjacent cell. The spreadsheet would be set up like this:

  • Column 1 would be "name"
  • Column 2 would be a drop down of what was loaned out
  • Column 3 would be the date
  • Column 4 would be a drop down menu again
  • Column 5 would be the date
  • Column 6 would be the drop down menu again
  • Column 7 would be the date

I Would like it to work so that each time i select something from the drop down menus, the current date would automatically be fill the adjacent cell so that I can track what was loaned out and the date each loan out was given. I am not sure if this is possible. I saw a script from OnenOnlyWalter that would add the date to column 2 and I tried to modify it so that it would work for multiple columns but no such luck.

share|improve this question
up vote 3 down vote accepted

Use this to add the dates:


function onEdit(e) {
  var aCell = e.source.getActiveCell(), col = aCell.getColumn(); 
  if(col == 2 || col == 4 || col == 6) {
    var adjacentCell = aCell.offset(0, 1);  
    var newDate = Utilities.formatDate(new Date(), 
      "GMT+1", "dd/MM/yyyy kk:mm:ss");


I've created an example file for you: Adjacent Cell
Add the code to the script editor (Tools > Script editor...), press the save button and you're on the go !!

share|improve this answer
Hi, thanks for your help. It worked perfectly. I got an error message but it worked. I adjusted the script so it puts the dates in the columns I needed. Thanks for writing the script and putting me in the right direction. – user46462 Aug 27 '13 at 22:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.