如何将值从Google表格的一列复制到另一列? [英] How to copy value from one column to another on Google Sheets?

查看:110
本文介绍了如何将值从Google表格的一列复制到另一列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何公式或脚本仅将值(而不是公式)从一列复制到另一列?我不想使用CTRL + SHIFT + V,因为我需要它是自动的.例如:

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. For example:

Column A  Column B
Value1
Value2
Value3

A列的所有值都是使用数组公式计算的,我需要每次A列都有新记录时,该值就永远传递到B列,因此,如果删除A列中的值或公式,则复制的值仍保留在B列中,可以这样做吗?

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?

请任何帮助!

推荐答案

您要

  • 将值从Google工作表的一列复制到同一Google工作表的另一列

如果我的理解是正确的,那么这个答案如何?请考虑将其视为解决问题的多种可能方式之一.

If my understanding is correct, how about this answer? Please consider this as one of many possible ways of solving your problem.

流量:
1.获取活动表2.获得有效范围(列)3.将值粘贴到范围(列)

Flow:
1. Get active sheet 2. Get active range (column) 3. Paste values into the range (column)

示例脚本:

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)
  })
}

参考:

这篇关于如何将值从Google表格的一列复制到另一列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆