简体   繁体   English

如何在表格中为一行中的非空白单元格收集数据和标题

[英]How to collect data and headers for non blank cells in a row in Sheets

I cannot find a solution to my problem:我找不到解决我的问题的方法:

I have a sheet with ~290 rows and ~80 columns.我有一张约 290 行和约 80 列的工作表。 The first row and column are fixed/header.第一行和第一列是固定/标题。

I would like to collect non-blank values and their header into column B.我想将非空白值及其标题收集到 B 列中。

在此处输入图片说明

I've tried to search for solutions, but I'm not as good at excel, so I cannot wrap my head around most of the advice that I've found.我试图寻找解决方案,但我不擅长 excel,所以我无法理解我找到的大部分建议。

In Google Sheets you could use an Array formula.在 Google 表格中,您可以使用数组公式。 I got this:我懂了: 在此处输入图片说明

The formula I've used:我用过的公式:

=ArrayFormula(CONCATENATE(IF(--(C2:G2<>"")*COLUMN($C$1:$G$1)<>0;$C$1:$G$1&" "&C2:G2;"")))

This is how it works:这是它的工作原理:

  1. (--(C2:G2<>"") will return an array of 0 and 1 if the cell is blank or not (--(C2:G2<>"")将返回一个由 0 和 1 组成的数组,如果单元格是否为空
  2. COLUMN($C$1:$G$1) will return an array of column numbers of each cell COLUMN($C$1:$G$1)将返回每个单元格的列号数组
  3. (C2:G2<>"")*COLUMN($C$1:$G$1) we multiply both arrays, so we will get an array of column numbers of non blank cells and 0 of blank cells (C2:G2<>"")*COLUMN($C$1:$G$1)我们将两个数组相乘,所以我们将得到一个非空白单元格列号和空白单元格 0 的数组
  4. <>0;$C$1:$G$1&" "&C2:G2;"") We check if each number in the array obtained in step 3 is 0 or not. <>0;$C$1:$G$1&" "&C2:G2;"")我们检查步骤 3 中获得的数组中的每个数字是否为 0。 If it's 0, it returns a null value, if not, it returns the value of cell如果为 0,则返回空值,如果不是,则返回单元格的值
  5. CONCATENATE will concatenate all values from previous array (step 4) so we concatenate null values with real values of non blank cells. CONCATENATE将连接前一个数组中的所有值(步骤 4),因此我们将空值与非空白单元格的实际值连接起来。

Not sure if this will make the sheet load slower if you have too many records.如果您有太多记录,不确定这是否会使工作表加载速度变慢。

Hope this helps希望这可以帮助

Excel is not the same Google Sheets Excel 与 Google 表格不一样

=ARRAYFORMULA(TRIM(REGEXREPLACE(
  TRANSPOSE(
    QUERY(TRANSPOSE(IF(C2:F13<>"",C1:F1 & ", ","")),,99^99)
  ),
  "((\s+)|(,\s*$))",
  " "
)))

在此处输入图片说明

My sample 我的样品

use:用:

=ARRAYFORMULA(REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
 IF(C2:G<>"", C1:G1&" "&C2:G&",", )),,99^99))), ",$", ))

0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取两张工作表之间一行中不匹配单元格的数量? - How do I get the count of non matching cells in a row between two sheets? 如何使 GG Sheets 上的索引和匹配功能匹配空白单元格? - How to make Index & Match functions on GG Sheets match blank cells? Excel-汇总:从非空白单元格提取数据 - Excel - Aggregate: Extract data from non blank cells 如何找到 Google Sheets 数据透视表的列和行标题? - How to find Google Sheets pivot table's colum and row headers? 是否可以计算Google表格中的空白单元格,但仅当它们位于具有值的单元格之间时才可以计数? - Is there a way to count blank cells, but only if they are between cells with values, in Google Sheets? 如何根据另一列中的第一个空白行计算一列中空白单元格的数量 - How to count the number of blank cells in one column based on the first blank row in another column 使用IF复制单元格以获取非空白值 - Copy Cells using IF for non -blank values 跳过空白单元格,直到在 Google 表格中添加值 - Skip blank cells until value added in Google Sheets 如何对同一行但前一列中为零的列中的所有单元格求和? (谷歌表格) - How to SUM all cells in a column that are equal zero in the same row but previous column? (Google Sheets) 如果行中的空白单元格数 = 某个数字,则突出显示整行 - Highlighting a whole row if number of blank cells in the row = a certain number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM