[英]How to copy value from one column to another on Google Sheets?
Is there any formula or script to copy only values (not formulas) from one column to another?.是否有任何公式或脚本可以仅将值(而不是公式)从一列复制到另一列? I don't want to use CTRL + SHIFT + V because I need this to be automatic.
我不想使用 CTRL + SHIFT + V 因为我需要它是自动的。 For example:
例如:
Column A Column B
Value1
Value2
Value3
All the values of column A are calculated with an array formula, I need that everytime that column A has a new record the value passes to column B for ever, so if the value or formula in column A is deleted the copied value remains in column B, is it possible to do this? A列的所有值都是用数组公式计算的,我需要每次A列有新记录时,值永远传递到B列,所以如果A列中的值或公式被删除,复制的值保留在列中B、可以这样做吗?
Please any help!请任何帮助!
You want to你想要
If my understanding is correct, how about this answer?如果我的理解是正确的,这个答案怎么样? Please consider this as one of many possible ways of solving your problem.
请将此视为解决问题的多种可能方法之一。
Flow:流动:
1. Get active sheet 2. Get active range (column) 3. Paste values into the range (column) 1. 获取活动工作表 2. 获取活动范围(列) 3. 将值粘贴到范围(列)中
Sample Script:示例脚本:
function copyvalues() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheet1');
const rg = sh.getRange(1,1,sh.getLastRow()); //Explore the various getRange functions
const va = rg.getValues(); //Explore Arrays if you are not familiar with it
va.forEach(function(r,i){
sh.getRange(i+1,2).setValues(r[0]).setNumberFormat('#,##0.00'); //Use setNumberFormat if you need to format your values with two decimal places and thousands separator (if not already done so)
})
}
Reference:参考:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.