且构网

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

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

更新时间:2023-11-30 22:54:22

使用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.