且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将具有原始工作表名称的列添加到合并工作表

更新时间:2023-11-30 22:45:58

使用 IFARRAYFORMULA 为第一张表添加类名并应用相同的模式第二张.

Use IF and ARRAYFORMULA to add the class name for the first sheet and apply the same patter for the second sheet.

应用上述内容的一种非常粗略的方法:

A very rough way to apply the above:

=ArrayFormula(QUERY({
'Class 1'!A3:I14,IF(N('Class 1'!A3:I14),"Class 1");
'Class 2'!A3:I14,IF(N('Class 2'!A3:I14),"Class 2")
},"SELECT Col1, Col10, Col3, Col4, Col5, Col6, Col7, Col8, Col9 WHERE (Col1 >= date '" & TEXT(TODAY(),"yyyy-MM-dd") & "' AND Col1 <= date '" & TEXT(TODAY()+9,"yyyy-MM-dd") & "')", FALSE))

N 返回一个数字,否则什么都不返回.它适用于上述公式,因为第一列包含 Google 表格将其作为序列号处理的日期.

N returns a number otherwise retuns nothing. It works in the above formula because the first column contains dates which Google Sheets handle them as serial numbers.

请注意,SELECT 子句也被修改,它显示 Col10 作为第二列.

Please note that the SELECT clause was also modified, it shows Col10 as the second column.