0

I have a script that will find the value in a lookup from column b and column a what I am trying to do is find the row and append the data in column n of that row is there a way of doing this, the script I have is as follows that will display the value of column A:

function findinB() {
  var sh = SpreadsheetApp.getActiveSheet();
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var last=ss.getLastRow();
  var data=sh.getRange(1,1,last,2).getValues();// create an array of data from columns A and B
  var valB=Browser.inputBox('Enter value to search in B')
  for(nn=0;nn<data.length;++nn){
    if (data[nn][1]==valB){break} ;// if a match in column B is found, break the loop
      }
Browser.msgBox(data[nn][0]);// show column A
}

hoping someone can help me

  • Welcome! Have you made a start at this? It seems to me you could grab the correct nn value and use it in some sort of sh.getRange(nn,14).getValue() or ….setValue() commands. Also, what is being appended to, or if it is appending to the matching row's column N, what is being appended? Appended to a value already written there, or did you just mean "written" not "appended"? We need examples and a demo of desired output. Per SE guidelines, also please edit your question to include your research/efforts, and what problem(s) you hit. – Joel Reid Apr 18 at 18:05
  • Cheers Joel Reid it was appended I think as I am building a cash register with the input being deducted from a members account with a Vlookup sort of thing to find their balance cell and deduct from a cell in my Till spreadsheet if that makes sense, I will try (nn,14) to see if that gives me the correct cell. – Johnny Cardel Apr 19 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.