简体   繁体   English

Google Sheets 公式:在 arrayformula 中扩展单个项目

[英]Google Sheets formula: extend single item in arrayformula

For simplicity, let's say I have a raw tab with several values in several columns:为简单起见,假设我有一个原始选项卡,其中几列中有多个值:

Raw tab原始标签

A    B        C      D
Code Product  Price  Stock
01   Pen      1      yes
02   Pencil   0.8    no
03   Rubber   0.5    no
04   Paper    0.3    yes

Now, in another tab I want to filter data from the raw tab, but I want to be able to insert some fixed value to it.现在,在另一个选项卡中,我想从原始选项卡中过滤数据,但我希望能够向其中插入一些固定值。 Look:看:

=filter({Raw!A:A,Raw!B:B,Raw!C:C},Raw!D:D="yes") 

This works but I want to add a forth column with a fixed value, as if it was like below这有效,但我想添加具有固定值的第四列,就像下面一样

=filter({Raw!A:A,Raw!B:B,Raw!C:C, "OK"},Raw!D:D="yes") 

But this formula above fails with Function但是上面的这个公式失败了 Function

ARRAY_ROW parameter 4 has mismatched row size. ARRAY_ROW 参数 4 的行大小不匹配。 Expected: 601. Actual: 1.预期:601。实际:1。

I understand that "OK" is just a single item and is not expanded for all the matches from filter, but how to make it so?我知道“OK”只是一个项目,并没有针对过滤器中的所有匹配项进行扩展,但是如何做到这一点?

or try:或尝试:

=FILTER({RAW!A:C, RAW!X:X&"OK"}, RAW!D:D="yes")

where column X is an empty column其中 X 列是空列

0

Or或者

=filter({Raw!A:A,Raw!B:B,Raw!C:C, if(Row(Raw!A:A),"OK")},Raw!D:D="yes")

在此处输入图片说明

use:用:

=QUERY(RAW!A:D, "select A,B,C,'OK' where D = 'yes' label 'OK'''", 0)

0

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM