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

查看:43
本文介绍了如何在 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?

请帮忙!

推荐答案

你想

  • 将谷歌工作表上一列的值复制到同一谷歌工作表上的另一列

如果我的理解是正确的,这个答案怎么样?请将此视为解决问题的多种可能方法之一.

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天全站免登陆