Google Sheets – Copy Part of Column to Another Sheet

google sheets

I'm trying to figure out how to duplicate part of the content of a column (text) to another column in other sheet. For example, I have column A in Sheet1 and I want to show only a word of this column in Sheet2. Here an example file.

Best Answer

Here how to do that with a script.

Code

function myFind(findRange) {
  var output = [];
  var find = ["Vault", "Drive", "Apps"];

  for(var i=0, iLen=findRange.length; i<iLen; i++) {
    for(var j=0, jLen=find.length; j<jLen; j++) {
      if(findRange[i][0].indexOf(find[j]) !== -1) {
        output.push([find[j]]);
        break;
      }
    }
  }
  return output;
}

Explained

The range is searched by the key words in the find array. Once a word is found, the search is stopped and the next search will commence. You can add more key words in the var find array.

Note

The order of key words is very important. Better is to choose unique key words, like:

  • Google Vault
  • Google Drive
  • Google Apps

All is of course dependent upon the data available.

Example

I've added the script (Tools>Script editor) and the ARRAYFORMULA version of the solution Punchlinern provided in your example file.