[英]How can the input of one cell be used to add or subtract from another cell in Google Sheets?
没有内置功能可以做到这一点,但您可以使用 Google Apps 脚本触发器。
您可能必须先阅读https://developers.google.com/apps-script/guides/sheets然后https://developers.google.com/apps-script/guides/triggers 。
下面是一个简单的例子,它使用简单的编辑触发器来更新编辑单元格左侧的单元格的值。
function onEdit(e){
const placeholder = '<update value>';
if( e.oldValue === placeholder ){
/** Modify the cell to the left */
let target = e.range.offset(0,-1);
target.setValue(target.getValue() + e.value);
e.range.setValue(placeholder);
} else {
// do nothing
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.