Created
December 31, 2020 15:43
-
-
Save jeffaspenburg/8120bcb8e0b38dc602c4abb3ee752868 to your computer and use it in GitHub Desktop.
Google Sheets multiple sections separate by pipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onEdit(e) { | |
var oldValue; | |
var newValue; | |
var ss=SpreadsheetApp.getActiveSpreadsheet(); | |
var activeCell = ss.getActiveCell(); | |
if(activeCell.getColumn() == 15||16||17 && ss.getActiveSheet().getName()=='Insights') { | |
newValue=e.value; | |
oldValue=e.oldValue; | |
if(!e.value) { | |
activeCell.setValue(""); | |
} | |
else { | |
if (!e.oldValue) { | |
activeCell.setValue(newValue); | |
} | |
else { | |
if(oldValue.indexOf(newValue) <0) { | |
activeCell.setValue(oldValue+'|'+newValue); | |
} | |
else { | |
activeCell.setValue(oldValue); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment